Welcome to CS 102-02 on the Web

Course news

Netscape has Trouble with Events

The Problem

There's a bug in Netscape Navigator (Communicator) 4.0 which prevents it from correctly running some Java applets. In particular, Netscape won't work with the MPG applet in problem 2.11. The applet will work with Internet Explorer (both Mac and Windows) and the Applet Viewers built into both Code Warrior and Visual Cafe.

If your MPG applet works in Visual Cafe, but then you can get an error in Netscape after transferring the HTML and class files to a Web server, you've probably stumbled across this problem. On the Mac you'll probably get a message that says:
Can't find class classname.class
On Windows, the message will probably say:
Applet name can't start: error: NoSuchMethodDefined: java.awt.TextField: method addActionListener(Ljava/awt/event/...

The Solution

If you've got the applet working in Visual Cafe, and you've moved the needed files to the Web server, don't worry. Use Internet Explorer (currently in the Communications folder on MacLab resources) to test your applet. Also, I'll use Internet Explorer (which does work) when I check out your applet.

What's wrong with Navigator?

The problem is that there are really two versions of Java floating around. The older version, called Java (or JDK) 1.0 (which was frozen at 1.0.2), has been superseded by Java 1.1 (currently at 1.1.6). Netscape claims that they support 1.1 in Communicator/Navigator 4.0, but they only support some of the new features.

One of the big changes between JDK 1.0 and 1.1 is in the event handling model. (Event handling is one of the features not yet up-to-date in Netscape.) Event handling is programming-speak for how computers find out what's going on in the world. The Comparison applet in Figure 1.13 (and your MPG applet) use event handling to decide when to perform the comparison (or calculate the MPG). Since the other applets in the assignment don't use event handling, they work okay in Netscape.

Java Class Documentation

The class documentation is a great source of information on Java. You'll find detailed information on all the classes and packages that are part of the Java language. So, suppose you wanted to find out about the Graphics class:

  1. Start with the Java Documentation.
  2. If you already happen to know that the Graphics class is part of the AWT package, you can click on package java.awt. (If you didn't know which package the Graphics class was in, then you'd have to wade through either the Class Hierarchy, or the Index).
  3. Assuming you're in the AWT package, you'll see a listing of all the classes in the package. Scroll down to Graphics, and follow the link.
  4. Now you can scroll through the documentation of the Graphics class. For Assignment 1, you'll be particularly interested in the many methods listed in the Method Index, such as draw3DRect and drawRoundRect.

Example code online

All the example code from the book (but not the packages yet) is online.

Written Tutorial on Visual Cafe

Information on how to use Visual Cafe, including creating projects, basic debugging and copying to the Web server.

Resources

Since Java is a Web-based phenomenon, you’ll often find loads of up-to-date information and help on the Web.

One of the best resources you can find on Java is the Java documentation itself. The following sources have lots of good information, but might require a little digging:
Source What's There
Java API Documentation The building blocks of Java programs (Includes info on things like the Graphics class, the Applet class and much, much more
The Java Tutorial, 2nd Edition One of the books in the Java series with lots of good info on getting started with Java.
Java documentation Overview of all documentation on Java
Java FAQ Index Listing of the many different Java FAQs
Java Glossary The definitions can be a bit skimpy and sometimes quite technical, but if it's 3 in the morning and you just have to know what the "Swing set" is, check it out.

Some other more general resources include those listed below.

Who What Where
Java HTP Textbook examples online (in Zip and tar formats)
You can also find the examples on the MacLab Resources drive in the Courses folder (MacLab Resources:Classes:Spring 1998:CS102-02:examples, to be exact).
www.prenhall.com/deitel
Sun The originator, and still chaaampeeen, of Java. www.sun.com/java/
Javasoft The Sun subsidiary responsible for developing new versions of Java and Java software. www.javasoft.com
JDK Docs Complete documentation on the latest Java Development Kit www.javasoft.com/products/jdk/1.1/docs/index.html
Gamelan Public repository of Java software. www.gamelan.com
O'Reilly O'Reilly's Java Web Site java.oreilly.com
Symantec Makers of Visual Café www.symantec.com

This page is maintained by Kurt Fenstermacher.
Many of the images on this and related pages came from Microsoft's SiteBuilder Web gallery.