Previous Page TOC Next Page



32


Writing Java Applets


by Rick Darnell and William Robert Stanek

Introduction


According to Sun Microsystems, "Java is a simple, robust, secure, object-oriented, platform-independent dynamic programming environment."

At first, all this Java talk can sound like a lot of voodoo. After you strip away the hype, however, it's easy to see how Java works effectively for implementing simple solutions to potentially complicated challenges in a distributed environment.

What Does the Java Language Offer?


Returning to Sun's description, Java is a language designed to make programming an easier task by hiding the parts that are best handled on a platform-specific basis and modeling the rest after the way people think. Following is a quick breakdown.

Simple


Java was designed with C and C++ programmers in mind. C and C++, however, had many hard-to-understand, rarely used features that the Java developers felt caused more pain than benefit. Important functions that come standard to every program, such as memory allocation and pointer arithmetic, are automatically handled by the Java system without any acknowledgment from the programmer.

In addition, Java is relatively small. Because they need to run on a wide variety of platforms, Java applications tend to be smaller than the multi-megabyte applications that predominate the marketplace. The overhead to run a Java program includes 40KB for the basic interpreter and classes plus an additional 175KB for the standard libraries and threading.

Robust


Java programs must be inherently reliable because any piece of Java bytecode must be capable of running on any platform. For this reason, a great deal of emphasis is placed on checking for bugs and problems early in the development process, beginning with basic language implementation.

Using pointers is a popular example. C++, a close cousin of Java, used extensive arithmetic to keep track of arrays and other memory variables. This setup enabled programmers to take full advantage of a specific platform, but it also created problems when pointers went awry, overwriting memory and corrupting data. It also prevented a program developed for a Windows environment from working on a UNIX platform.

The Java compiler checks for a wide variety of errors beyond basic syntax, including type casting and method invocations. If you've made a mistake or mistyped, chances are good that your mistake is flagged by the compiler, which is a far better place than the interpreter at run time.

Object Oriented


Object oriented, probably one of the most overused and confusing terms in computer lingo, really has a simple and easy-to-understand meaning. It facilitates creating clean and portable code by breaking software down into coherent units.

In other words, object-oriented programming focuses on the ways of interacting with data, rather than the programming language. For example, if you're going to mow the lawn, are you going to be concerned about starting the lawnmower or knowing the type of socket used to install the spark plug? In object-oriented programming, the focus is on the lawnmower.

Objects become the basic building blocks of the application. Because of its modularity, an object can change without major revisions to the other program elements.

Getting the Tools You Need


The first item needed for writing applets is the Java Development Kit, commonly referred to as the JDK. The JDK is currently available for most operating systems, including Sun Solaris, OS/2, AIX, Windows 3.1, Windows 95/NT, and Macintosh.

Packages in the Developer's Kit


The JDK is a terrific resource. It includes many different code libraries that allow you to save time and develop code easier. Table 32.1 summarizes the code libraries and their uses.

Table 32.1. Code libraries included in the JDK.

Package Description
java.lang The core set of classes for the Java language that provide basic functions, such as string and array handling.
java.applet A set of classes that relate to the applet environment and are generally used when viewing applets.
java.awt A set of classes that provide graphical interface tools such as buttons, controls, scroll bars, and windows.
java.awt.image A set of classes related to using images.
java.awt.peer A set of classes for AWT peer classes and methods.
java.io A set of classes that provide standard input/output and file I/O utilities.
java.net A set of classes that provide tools for accessing networks by protocols, such as FTP, Telnet, and HTTP.
java.util A set of classes that provide core utility functions such as encoding/decoding, hash tables, and stacks.
sun.tools.debug A set of classes that provide debugging functions and tools.

TIP

The Java Development Kit (JDK) is found on the JavaSoft site at http://java.sun.com/.

For more information on the differences between Java applications and applets, see Chapter 31, "Including Java Applets in Your Web Page."



Tools in the Developer's Kit


You will also find most of the tools you need to work with Java right in the JDK. You use these tools to create Java bytecode, view your programs, and debug your code. Table 32.2 shows a brief summary of these tools and their uses.

Table 32.2. Developer's tools.

Tool Name Executable Description
Java AppletViewer appletviewer Used to view applets without a Web browser.
Java interpreter java Runs Java bytecode.
Java compiler javac Compiles Java programs into bytecode.
API documentation generator javadoc Creates API documentation in HTML format from Java source code.
Java header and stub file generator javah Creates C language header and stub files from a Java class, which allows your Java and C code to interact.
Java class file disassembler javap Disassembles Java files and prints out a representation of Java bytecode.
Java language debugger jdb Helps you find and fix problems in your Java code.

Using an Editor to Create Java Programs


Although you cannot use the FrontPage Editor to write applets, you can use your favorite text editor or word processor. You must save your work in a standard ASCII text format with the .java extension.

In Peter Norton's Guide to Java Programming, you will find a terrific text editor written entirely in Java. This application, called Jompanion, was created to be used as a companion tool for other applications. You can easily configure Jompanion for use with FrontPage (see Figure 32.1). Here are the steps you use:

  1. Start the FrontPage Explorer.
  2. Open the Options dialog box by selecting Options from the Tools menu. Click the Configure Editors tab.
  3. With the Configure Editors tab active, click the Add button.
  4. In the File Type field enter java.
  5. In the Editor Name field enter Jompanion.
  6. In the Command field, you need to enter the actual path to the file Jompanion.bat on your system, such as c:\java\mystuff\Jompanion.bat. This batch file contains a command that executes Jompanion.

Figure 32.1. Configuring the FrontPage Explorer for other editors.

Now you can access Java source files directly from the FrontPage Explorer. All you need to do is double-click a Java source file ending with the .java extension and FrontPage automatically loads the file into Jompanion. When you are done editing the file, Jompanion automatically saves the file in ASCII text format for you.

Compiling Java Programs


All Java source files that you save as ASCII text with the .java extension must be compiled to bytecode before you can use them in a Web page. To compile your Java programs, you use the Java compiler. When you compile the source with the .java extension, the Java compiler creates a separate file for each class in your program. These compiled class files are named with the .class extension. If an application has more than one class file, you should always invoke the Java interpreter with the name of the class containing the main method.

Although compiling applications on the Macintosh is as easy as dragging the .java file onto the compiler, other system owners should not be too envious. On other systems, javac is a command-line program. Because the command line offers a simplified interface and streamlined design, the version of javac for UNIX, Windows 95/NT, and OS/2 is actually much more versatile.

Using a Graphical Compiler


Following are the steps you use to compile a Java program using a graphical compiler:

  1. Drop the .java file onto the compiler or select Open from the compiler's File menu.
  2. The compiled output file(s) with the .class extension is generally placed in the same directory as the source.

Using a Command-Line Compiler


Here are the steps you use to compile a Java program using a command-line compiler:

  1. Change to the directory containing the source code and type the following at the command prompt:
    
    
    
    javac yourProgram.java
    yourProgram.java is the actual file name of your Java program, such as
    
    
    
    javac Jompanion.java
  2. The compiled output file(s) with the .class is generally placed in the same directory as the source.

Creating Java Applets


Creating Java applets is easier if you already have a background in programming. With Java's tight structure, the basic format of an applet is fairly straightforward. You walk through an example here.


TIP

You can access online tutorials and documentation for Java and object-oriented programming from the Sun site, http://java.sun.com/.



An Object and Class Primer


Java is object-oriented, meaning that Java programs are built out of sections of code which package data with the instructions that affect it. A class is the template from which objects are created.

Think of it as a suburban neighborhood of cookie-cutter tract houses. All the houses begin as a blueprint, and every house uses the same one. You can't live in a blueprint, so you have put the concrete, lumber, pipes, wire, and drywall together to build a house. In Java, this is called instantiation, and an instance of the blueprint is called an object. Many houses (objects) are built from the same blueprint (class).

Simple enough, right? Now it's time to move a little dirt and get your fingernails dirty.

Applet ABCs


At its simplest, an applet consists of two parts—the class declaration and a paint method. The following snippet contains a breakdown of the common elements for any applet:




import java.awt.Graphics;



public class MyApplet extends java.applet.Applet {



    public void paint (Graphics g) {



       your statements here;



    }



}

The first line includes a copy of the Graphics class from Java's Abstract Windowing Toolkit (AWT), which contains the methods needed for putting graphics, including text, lines, and dots, on the browser screen. This line may also be represented as import java.awt if more than the Graphics class is used.

Second, the actual applet is declared. It is public, meaning it is available to any other class, and it is a subclass of Java's Applet class, which provides the behavior necessary for interaction with the host browser.

The third section defines a method called paint, which the Java interpreter uses to put the information on the screen. It is public to the class, and void indicates it does not return a value when it is completed. Its one parameter is an instance of the Graphics class imported on the first line of the program, which is referred to as g. This reference could just as easily be called bob or hammer, but g is the commonly used convention.

Displaying with Paint


Now that the applet is defined, you need to make it do something. For the paint method, include the following line:




g.drawString("Have a nice day.",50,25);

After compiling the code and inserting it into an HTML document, you get something that looks like Figure 32.2.

Figure 32.2. MyApplet displays a simple message on the screen.


TIP

To test your applet, you can use a browser such as Netscape Navigator (2.0 or later) or Microsoft Internet Explorer (3.0 or later). Another alternative is the Java AppletViewer, which is provided with Java Development Kit. For more information, see "Using the Java AppletViewer" later in this chapter.

For more information on including applets in your Web page, see Chapter 31, "Including Java Applets in Your Web Page."


Of course, applets can do much more. By including some other AWT classes, you can make the text look better. First, you need the classes that control the font and display color:




import java.awt.Font;



import java.awt.Color;

Now, after the class declaration, create a variable to hold a new setting for the text:




Font f = new Font("TimesRoman",Font.ITALIC,24);

After the paint method declaration, use the Graphics.set methods to set the display before writing to the screen:




g.setFont(f);



g.setColor(Color.red);

With this extra bit of effort, the applet now looks like Figure 32.3.

Figure 32.3. MyApplet now displays in a larger font in red after some minor revisions to the code.

Again, this example is limited. The addition of a parameter to control the string makes it more useful to the HTML author. After the class declaration, declare the message as a variable:




String message;

A new method is also required to initialize the value of message.


Applet Activities

In addition to paint, four major activities exist in the life of an applet. If any get omitted, default versions are provided in the Applet class. This setup is called inheritance. Providing new methods in the applet is called overriding.

The first activity is initialization, accomplished with the init method: public void init() {...}. This activity occurs once, immediately after the applet is loaded. Initialization includes creating objects, setting graphics, or defining parameters. It can only happen once in the applet's life.

The second activity is starting, accomplished with the start method: public void start() {...}. After initialization, activity begins. This activity can also happen if a user activity stopped the applet. Starting can happen many times in the life of an applet. The paint method gets invoked somewhere in this method.

The next activity is stopping, accomplished with the stop method: public void stop() {...}. This activity can be an important method to include because by default the applet continues running and using system resources, even after the user has left the page with the applet. Like start, stopping can occur many times in the course of execution.

The last activity is destroying, accomplished with the destroy method: public void destroy() {...}. Destroying is where an applet throws out its own garbage after completing execution—when the applet is no longer needed or the user exits the browser. Java provides adequate coverage in this department, so you don't need to override this method unless you want to return specific resources to the system.


Initializing the message parameter requires overriding the init method for the applet:




public void init() {



    this.message = getParameter("message");



    if (this.message == null) {



        this.message = "Your message here."; }



    this.message = "A note from Java: " + this.message;



}

This method retrieves the value of the parameter in the HTML document. If a parameter named message is not found, then the value is null and message is set to the default string, Your message here.


TIP

Java is case sensitive for all of its variables, even when passed back and forth as parameters. Remember, Bob isn't bob.


Now you need to update the paint method so that it uses the string defined in init, rather than the literal string in the drawString method:




g.drawString(this.message);

Using the AppletViewer again now generates the results in Figure 32.4.

Figure 32.4. The default message generated by MyApplet, after checking for a message parameter and finding none.

Using the Complete Applet


The complete listing for MyApplet appears in Listing 32.1. Note the use of the parameter in the init method. Enter this listing in your text editor. Save the file as ASCII text in the same directory as the HTML page you use to display the applet. The file name must be MyApplet.java. Compile the applet.

Listing 32.1. A simple applet for displaying text on-screen.




import java.awt.Graphics;



import java.awt.Font;



import java.awt.Color;



public class MyApplet extends java.applet.Applet {



    Font f = new Font("TimesRoman",Font.ITALIC,24);



    String message;



    public void init() {



        this.message = getParameter("message");



        if (this.message == null) {



            this.message = "Your message here."; }



        this.message = "A note from Java: " + this.message;



    }



    public void paint(Graphics g) {



        g.setFont(f);



        g.setColor(Color.red);



        g.drawString(this.message,50,25);



    }



}

To use this applet, follow these steps:

  1. Create a new page in the FrontPage Editor.
  2. Open the Java Applet Properties window by clicking the Advanced toolbar's Insert Java Applet button.
  3. Set the Applet Source field to MyApplet.class.
  4. Set the width to 400 and the height to 50.
  5. If the class file is not in the same directory as the HTML document that uses the applet, you must set the Applet Base URL property.
  6. To set your own display message, you must set a parameter for the applet. Click the Add button. Enter message in the Name field. Then enter the message you want to display in the Value field.
  7. Close all open dialog boxes and save the page.

Interacting with the User


All the little messages on the screen are neat, but how about actually doing something? The mouse is the preferred weapon on the World Wide Web, so I'll start with reacting to a user doing things with the mouse, beginning with a mouse click.

Looking for a Click


Java divides a mouse click into two parts: mouseDown when the button is depressed and mouseUp when it's released. This might seem like micromanagement, but it's really quite useful.

Think of a drop-down menu. Click and hold to view the menu and then drag the mouse down to your choice and release the button to select it. In Java, the mouseDown indicates the menu is selected and the items are displayed and mouseUp indicates a selection is made.

Mouse events are handled by overriding the default method for the particular action. The general syntax follows this example:




public boolean mouseDown(Event mdEvent, int x, int y) {



...stuff to do...



}

The method returns a boolean value: true when the button is down and false when it's up. Its first parameter is the actual event, which is itself an instance of a class. All system events generate a new instance of the Event class, which includes information on the type of event, where it happened, and when it took place. This provides a way to grasp the event and preserve it until your applet processes it. The next two parameters are the screen coordinates of where the event occurred.

A simple way of viewing this activity is to include the following two methods in your applet:




public boolean mouseDown(Event mdEvent, int x, int y) {



    System.out.println("Click at " + x + ", " + y);



    return true;



}



public boolean mouseUp(Event muEvent, int x, int y) {



    System.out.println("Release at " + x + ", " + y);



    return true;



}

TIP

The coordinates relate to the space occupied by the applet only. An event object is not created for activities outside the applet.


Note the last line in both methods, return true. This value is used so that other parts of the user interface can work with the event if it needs to. A good rule of thumb is that the event method should return true if it's your method that works with it.

Now, use the this information for a little target practice. The applet in Listing 32.2 draws a target and gives you the chance to hit it six times (see Figure 32.5).

Listing 32.2. The TargetShoot applet looks for a mouseDown event and places a small circle on the screen where it occurred.




import java.awt.Graphics;



import java.awt.Color;



import java.awt.Event;



public class TargetShoot extends java.applet.Applet {



    final int shots = 6;



    int xhit[] = new int[shots];



    int yhit[] = new int[shots];



    int shotsTaken = 0;



public void init() {



    setBackground(Color.white);



}



public boolean mouseDown(Event mdEvent, int x, int y) {



    if (shotsTaken < shots)



        bang(x,y);



    else System.out.println("Out of bullets.");



    return true;



}



public void bang(int x, int y) {



    xhit[shotsTaken] = x;



    yhit[shotsTaken] = y;



    shotsTaken++;



    repaint();



}



public void paint(Graphics g) {



    g.setColor(Color.red);



    for (int i = 0; i < shotsTaken; i++) {



        g.fillOval(xhit[i] - 10, yhit[i] - 10, 20, 20);



    }



}



}

Figure 32.5. The TargetShoot applet places a small blue dot on the screen everywhere the user clicks.

The code initializes the variables that store the maximum number of shots and the current number of shots taken, along with an array to hold the x and y positions of each one. The mouseDown method calls the bang method when the mouse button is clicked. The bang method records the location of the shot and calls the repaint method to update the screen. The last method, paint, sets the color of the hits to blue and paints a circle at each of the locations where a shot has been taken.

To use this applet, here are the steps you follow:

  1. Enter Listing 32.2 in your text editor. Save the file as ASCII text. The file name must be TargetShoot.java.
  2. Compile the applet using the Java compiler.
  3. Create a new page in the FrontPage Editor and then open the Java Applet Properties window by clicking the Advanced toolbar's Insert Java Applet button.
  4. Set the Applet Source field to TargetShoot.class.
  5. Set the width to 600 and the height to 400.
  6. If the class file is not in the same directory as the HTML document that uses the applet, you must set the Applet Base URL property.
  7. Close all open dialog boxes and save the page.

Pressing Some Keys


Java can also look for keyboard activity using the keyDown method. The syntax of the method is similar to the mouse events:




public boolean keyDown(Event kEvt, int key) {



...



}

Like the other user input events, keyDown needs an event variable as one of its parameters. Instead of x and y coordinates for the location of the event, it accepts an ASCII value representing the key. If you want to turn the value into the actual character, use the char casting method:




theCharacter = (char)key;

As part of the event class, a set of key names are provided to make it easier to write code for items such as the arrow and directional keys. These key names are summarized in Table 32.3.

Table 32.3. Key-related events

Event.Property Key
Event.HOME Home key
Event.END End key
Event.PGUP Page Up key
Event.PGDN Page Down key
Event.UP Up arrow
Event.DOWN Down arrow
Event.LEFT Left arrow
Event.RIGHT Right arrow

The next task is to display characters on the screen in response to the keyboard. Whatever key the user presses appears on the screen (see Figure 32.6), and pressing the Page Down key clears the screen. Listing 32.3 shows the KeyPhrase applet, which uses the same Event class used by the TargetShoot applet.

Listing 32.3. The KeyPhrase applet.




import java.awt.Graphics;



import java.awt.Event;



import java.awt.Font;



import java.awt.Color;



public class KeyPress extends java.applet.Applet {



    char currentKey;



    int valueKey;



public void init() {



    setBackground(Color.white);



    setFont(new Font("TimesRoman",Font.ITALIC,24));



}



public boolean keyDown(Event keyEvent, int key) {



    valueKey = key;



    switch (key) {



    case Event.PGDN:



        setBackground(Color.white);



        currentKey = 0;



        break;



    default:



        currentKey = (char)key;



    }



    repaint();



    return true;



}



public void paint(Graphics g) {



    switch (currentKey) {



    case 74:



        g.drawString("JAVA", 20, 30);



        break;



    case 106:



        g.drawString("java", 20, 30);



        break;



    case 0:



        g.drawString(" ", 20, 30);



        break;



    default:



        g.drawString(String.valueOf(currentKey)+" is ASCII: "+valueKey, 20, 30);



    }



}



}

Figure 32.6. The KeyPress applet displays the character pressed and its ASCII value, except when the user presses uppercase or lowercase j and it prints Java.

For the most part, this is a pretty straightforward operation. When a key is pressed, the keyDown method checks to see which key is pressed. If it's the Page Down key, the screen is cleared and nothing is displayed. Otherwise, the value of the key is passed to currentKey.

A few items in this applet are new. First, notice the two uses of the switch control. This is in effect a large if-then statement. The variable to compare is included in the first line, followed by a series of case statements with values. If the variable in the switch statement matches the value in the case statement, the set of instructions under it are executed—but there's a small hitch.

Usually, once the statements under the specific case are completed, execution passes to the next case statement in line, which means the comparison takes place again. This isn't what you want, and so a break command is placed at the end of each case. When the program reaches the break, control is passed to the end of the entire switch.

The last line of each switch is the optional default. This is used to guarantee a certain behavior if a match is not found within any of the cases. Because it's the last item, a break isn't needed.

Working with Images


Loading and displaying images in Java is an easy task, thanks to the Image class in java.awt. The first method to work with in Image is getImage, which loads the image from the Internet to your applet.


TIP

Images are not integrated with the applet. Currently, Java supports only GIF and JPEG image files.


To load the image file, getImage needs to know where to find it. You have two ways of indicating this:

Although the first method appears to be much simpler, it is not very flexible. If the location of the image changes, you have to change the source code and recompile the applet.

The second form is the preferred method and includes two options for establishing the base URL:

As it's said, a picture is worth a thousand words, so here are a few examples of how getImage works:

It's important to note one thing at this point—the applet has only loaded the image; it hasn't done anything with it. It only exists as an Image object called pict. You display it using a method from the Graphics class:




public void paint(Graphics g) {



    g.drawImage(pict,10,10,this);



}

NOTE

You may have noticed the this parameter in the drawImage method. The this parameter refers to the current instance of an object.


That's all there is to it. This form of drawImage displays pict with the top-left corner at the coordinates 10,10. You can also add a second set of numbers to define the width and height of the image when it's painted, enabling you to make it fit anywhere you want.


TIP

Expect image degradation when you expand or contract an image very far beyond its original size. Changing the height-to-width ratio also distorts the image.


The entire applet to display the image (see Figure 32.7) is shown in Listing 32.4. The Animator applet uses these basic operations to display a series of images, which give the appearance of motion.

Listing 32.4. A simple applet to load and display an image.




import java.awt.Graphics;



import java.awt.Image;



public class showPict extends java.applet.Applet {



image pict;



public void init() {



    pict = getImage(getCodeBase(),"images/garden.gif");



}



public void paint(Graphics g) {



    g.drawImage(pict,10,10,this);



}



}

Figure 32.7. The showPict applet loads an image from the images subdirectory of the javaApplets directory.

Using the Java AppletViewer


During applet development and testing, sometimes it's easier to bypass the unnecessary overhead of a browser. If your browser doesn't support applets, you still need a way to view the applets. At this point, the Java AppletViewer (see Figure 32.8) comes in handy. Only the applet is displayed; the rest of the HTML is ignored.

Figure 32.8. The Java AppletViewer enables the programmer to view embedded Java applets without using a browser.

Viewing an Applet


The AppletViewer searches the HTML document for the <APPLET> tag, such as what's shown in Listing 32.5. Keep in mind that FrontPage automatically adds the markup you see whenever you add an applet to a Web page in the FrontPage Editor.

Listing 32.5. A simple HTML document containing an applet tag.




<HTML>



<HEAD>



<TITLE>The animation applet</TITLE>



</HEAD>



<BODY>



<APPLET CODE="Animator.class" WIDTH=460 HEIGHT=160>



<PARAM NAME=imagesource VALUE="images/beans">



<PARAM NAME=endimage VALUE=10>



<PARAM NAME=pause VALUE=200>



</APPLET>



</BODY>



</HTML>

Using the information contained within the tag, the AppletViewer opens a window and runs the applet. Other HTML information on the page is ignored—only the applets appear.

The Java AppletViewer is distributed with the Java Development Kit and is found in the same directory as the Java compiler and interpreter. To run the command-line version of the AppletViewer, use the following steps:

  1. Create a document with an applet in the FrontPage Editor.
  2. From a command line prompt, type appletviewer [path/]filename.html.
    If the AppletViewer launches from the same directory as the HTML document, you don't need the path name. Otherwise, the path is relative to your current location in the directory structure. The extension .htm is also valid for the viewer.
  3. Any applets found in the HTML document are loaded and run, with each applet in its own instance of the AppletViewer.
  4. Although you cannot change the initial parameters contained within the HTML page from the AppletViewer, you can start the applet from the beginning by choosing Applet | Restart. To load it again from memory, select Applet | Reload.
  5. Leave the applet by choosing Applet | Quit on the AppletViewer's toolbar.

To view an applet with the graphical version of the AppletViewer, you can do one of the following:


Java Resources on the Web


Because Java as a language and way of thinking has found its fame and fortune on the World Wide Web, the Internet remains the primary source of information and tools to learn more about Java. Here are a few of the high spots you might want to visit.

JavaSoft (http://java.sun.com/)


JavaSoft, a subsidiary of Sun Microsystems, is the lead figure in the continuing evolution of Java and Java products. Visit its Web site (see Figure 32.9) first when looking for information, documentation, development kit updates, applet downloads, and other feedback.

Figure 32.9. The JavaSoft home page includes links to the Java Developers Kit, HotJava, and other information of use to Java developers.

Originally part of the Sun Microsystems Web site, JavaSoft was created to handle the dramatic increase in attention Java has received since its release.

JavaWorld (http://www.javaworld.com/)


The first online publication devoted entirely to Java, JavaWorld (see Figure 32.10) is a monthly publication that includes hands-on tips and tricks. A programming contest, "Applet of the Month," is a regular feature. Other articles include links to source code and other helpful items.

Figure 32.10. JavaWorld includes interviews with the movers and shakers in the Java realm, along with hands-on examples, tutorials, and contests.

alt.lang.java


Although not technically a source for applets, the alt.lang.java newsgroup provides a great source of information about Java and its uses. Following the threads can also lead to Java applets and applications, where you can learn from people already making the most of this new language.

Summary


Java is a powerful tool in your quest to create a killer Web site. Use the basics you learned in this chapter to get a head start in the increasingly complex world of Web publishing. As you experiment with Java, start with the Java Developer's Kit. Familiarize yourself with its package libraries and tools. Afterward, try to create your own applets and Java-powered Web pages.

Previous Page Page Top TOC Next Page