Enhancing Web Pages with Java Applets for Non-Programmers
Even with colorful text and images, most Web pages are static. Java applets help you create animated and interactive Web pages without tedious programming.
While Java programming can be learned by C and C++ programmers, most Web designers don't program. This class provides hand-on experience for non-programmers to use Java applets as building blocks to create more effective Web sites. You explore Java applets step-by-step and learn how to embed them into your Web pages. At the end of the class, you will have learned how to find the applets you need and use them for effective site design.
This course provides hands-on instruction in the UC Berkeley Extension Computer Training Facilities in San Francisco.
Prerequisite: Familiarity with HTML and Web page design or completion of Enhancing Web Pages with HTML.
Course information: (510) 643-6904
MICHAEL WOLFE, M.S., is Vice President of Engineering at Kana Communications, a startup software company focusing on enterprise email support solutions. He has been teaching computer science and developing real-world systems for 10 years at Stanford University, Goldman Sachs, and Wells Fargo. His prior position was as a Director of Engineering of Internet Profiles Corp.
June 20, 8:30 am-5:30 pm
UC Extension Downtown, 150 Fourth St.
(Near Moscone Center at Howard)
Class Outline
- Introduction
- Java fundamentals
- Where to find Java applets
- Running Applets within a Web Browser
- Adding a Java Applet to HTML
- Customizing Applets Settings
Assorted Applets
Graphing Applets
Additional topics/wrap-up
Class notes
Introduction
Where are we?
- Enhancing Web Pages with Java Applets for Non-Programmers
- Credit, laboratory course
- We're going to have fun!
Who are you?
- WWW site designers
- Intranet engineers
- Hobbyists
- Might be programmers, might not
- Some HTML experience...this is not an HTML class
Who am I?
- Michael Wolfe (wolfe@cs.stanford.edu)
- Software engineer/manager
- Internet technologies
- Java programming and design
What are we going to do?
- Talk about what Java is and what it is good for
- How to find Java applets
- How to use Java applets
- Examples
- Exercises
- Project
- Next steps
How will the class work?
- Some lecture
- Mostly hands on with demos and help from me
- We'll use my lecture notes as the starting point
- We'll surf the WWW a lot
How the lab works.
- You have a machine
- You can use either Netscape or Microsoft browsers (3.0 or above)
- You can use notepad as your text editor
- You can get applets from http://www.vivids.com/ij2.
- We'll pull lots of stuff from the net
- Work with your neighbor
- I might also ask you to share some of what you have done
Java Fundamentals
Java is a language, platform, and religion
Java is a language
Java is an API
- Libraries for user interfaces, networking, databases, multimedia, I/O
- Build platform-independent programs
- Theoretically can replace Win32, UNIX, Mac
- This is the center of the controversy....which model of computing will prevail: proprietary or open?
Java as universal executable content language - analogous to HTML
What is an applet?
- It is a "miniature" application, usually with a single function
- Usually means that it runs within a WWW browser
- Often loaded, used, then discarded. "Disposable" software
- Security restrictions: no access to local resources, no network connections except back to original server
- Traditionally, they have been "cute": animations, banners, etc.
- But, they are getting more sophisticated: online commerce, product configuration, database queries, etc.
What is a Java application?
- Can do all of the things that any application in any other language can do
- Fewer security restrictions than applets
- Are usually platform independent, although platform hooks are appearing
- Cannot be run through a browser
- We won't look at applications in this seminar
What do applets look like?
Where to find applets
Adding a Java Applet to HTML
Example, from ESPN:
< APPLET CODEBASE="http://scores-espn.sportszone.com/java"
CODE="starwave.sportszone.scorepost.ScorePost.class" vspace="1"
WIDTH="128"
HEIGHT="182"
ARCHIVE="ScorePost.zip">
< PARAM NAME="cabbase" VALUE="ScorePost.cab">
< PARAM NAME="bgcolor" VALUE="#638494">
< PARAM NAME="text" VALUE="#FFFFFF">
< PARAM NAME="data" VALUE="/cgi/scoretracker/databuffer.dll?/scoretracker/scorepost/data/all.dat">
< PARAM NAME="ad data" VALUE="/ad/scorepost/all.txt">
< PARAM NAME="target" VALUE="_top">
< PARAM NAME="delay" VALUE="3500">
< PARAM NAME="data time" VALUE="30000">
< PARAM NAME="inactive data time" VALUE="300000">
</APPLET>
Applet syntax.
The <APPLET> tag
- Required
- Several optional settings
- Wherever this is put in the HTML page is where the applet will be put...it can be anywhere on the page, even in a table or frame
- There can be multiple ones per page
The CODE setting
- Required
- Gives the name of the primary class
- Can be absolute or relative
- CODEBASE can define where to find it
The CODEBASE setting
- Optional
- Gives a directory, either relative or absolute, where the applets files can be found
- Without it, the CODE setting defines where the files are
The HEIGHT and WIDTH settings
- Required
- Controls, well, the height and width of the area that the applet is put into
The ARCHIVE setting
- Optional
- Designates a compressed file that contain all of the .class files for the applet
The <PARAM> tag
- Control settings that the author of the applet has defined
- This is where most of the customization occurs
- The set of available PARAMS for an applet defines the API
Customizing Applets Settings
The Ticker applet
http://www.vivids.com/ij2/assorted/Ticker.html
To get set up:
- Create a working folder for this class
- Click download to get the .zip file
- Put it into your working folder
- Unzip it
- Click on Ticker.html
- It should work the same way it does on the http://www.vivids.com site
- You can now edit Ticker.html to get going
Things to try:
- Change the HEIGHT setting
- Change the WIDTH tag
- Change the "text1" param
- Add a "text3" param
- Try different fonts: TimesRoman, Helvetica, Courier, Dialog, DialogInput, ZapfDingbats
- Try different styles: Plain, Bold, Italic, BoldItalic
- Play with the delays to see what happens
- Find a new background out on the net somewhere, load it, and change it
- Put two banners on one page
- Change CODEBASE to point to where this applet resides on www.vivids.com/ij2. Hint: you need to look at the page source for the ticker example on the site and try to figure out where the .class file is.
Text Applets
WaveText
http://www.vivids.com/ij2/text/WaveText.html
Things to try:
- Change Text
- Change TxPointSize
- Change WaveLength
- Change Amplitude
Stencil
http://www.vivids.com/ij2/text/Stencil.html
Things to try:
- Same as above (Text, TxPointSize, etc.)
- New image
- Set the TxUrl PARAM
Stealing an applet
- Look at the applet at http://java.sun.com/applets/BarChart/1.0.2/example1.html.
- Build a WWW page that uses the applet by pointing CODEBASE to the address at Sun where the applet is.
- Now, download the applet to your local machine and change CODEBASE to load the applet from a local directory.
Assorted Applets
Coalesce
http://www.vivids.com/ij2/assorted/Coalesce.html
Things to try:
- Change the string
- Change Steps
- Change DelayBetweenChars
- Change text size and style
Audio
http://www.vivids.com/ij2/fund/Audio.html
Image Applets
WaveImage
http://www.vivids.com/ij2/image/WaveImage.html
Things to try:
- Amplitude
- WaveLength
- BeginRange, EndRange
- New graphic
Other lecture topics
Pros and cons of Java applets
- Platform independent
- Security
- Ubiquitous
- Performance
- Capabilities
- Hype
Alternatives to Java
- ActiveX
- More powerful
- Windows-only
- Security issues
- Appropriate for MS-only environments.
- Javascript (an example. )
- Integrates well with HTML.
- Can do some lighweight client-side processing.
- Ubiquitous.
- VBScript
- Similar to JavaScript, but Windows and IE only.
- Dynamic HTML
- Example.
- Example.
- Other examples.
- Allows you to change and move HTML elements around on the page.
- Usually used in conjunction with JavaScript.
- Will become standard and very common.
Future of Java
- Java 1.2
- Java Foundation classes (JFC)
- Performance improvements
- Relaxed security
- Platform-specific hooks
A clock applet
- Download the applet.
- Try changing the fonts and colors.
- (Useful key to colors is here)
- Try changing the date format.
A menu applet
- A WWW site with some useful navigation applets is http://www.liquidcoolresearch.com/java.
- Very useful applet at this WWW site.
- Look at the example.
- Read the documentation.
- Download and unzip it.
- Change the background image.
- Try different fonts and colors.
- Add and remove menu items.
A tree-view applet
- Very useful applet at this WWW site.
- Download into a separate directory. Unzip.
- Look at TreeView.html.
- Now, look at TreeView.dat (this is where the interesting part is).
- Remove some nodes.
- Add some nodes.
- Find a very small .gif out on the net and use it.
A billboard applet
- Very useful applet at this WWW site.
- Download into a separate directory. Unzip.
- Try changing the graphics and the hyperlinks.
Charting applets
http://www.netcharts.com
Steps:
- Find a demo applet
- "View Source"
- Save the HTML to a local file
- Change CODEBASE to point to http://www.netcharts.com/netfactory/classes
- Play with the parameters to make your own charts
Other applets
- Sun applets.
- A Calendar applet.
- A clock.
- Java boutique.
- Java Applet Reviews at JARS
Individual Project
Create your own WWW page from scratch
It should contain several applets, both from our book and from the WWW
Spend about 45 minutes on it
What to do next
- Practice, practice, practice
- Keep browsing and looking for cool applets
- Keep track of Java developments
- Learn how to program and build your own applets