Lesson 2 | Java versions and browser versions |
Objective | Ensure that your browser will support the applets used in this module. |
Java versions | Browser versions
The applets you will see in this module use the Java 1.1 event handling model . This means that they will work only with browsers that support Java 1.1 and above. In previous modules it did not matter which browser or browser version you used, because all of the work was done on the server.
You may remember that in Java 1.0, you handled events by overriding an applet (or subcomponent) method such as action()
.
In Java 1.1 you handle events by implementing a listener interface such as ActionListener
, and adding your applet (or subcomponent) to a listenervlist. Make sure that your browser supports the Java 1.1 event model.
Review applet AWT code for a simple user interface in the next lesson.
Java 1.1 Improved event handling
Java 1.1 provided a completely new event model. Instead of propagating events to all objects that might possibly have an interest,
objects in Java 1.1 registered their interest in particular kinds of events and get only the events they were interested in hearing. T
The Java 1.1 event model is more efficient than the Java 1.0 event model.
The new event model is also important in the context of JavaBeans. The Java 1.0 events were specific to the AWT.
The new model has been designed as a general purpose feature for communication between software components.
How to use events in the more general sense is beyond the scope of this mofulr, but you should be aware that it is possible.
New components and containers
Java 1.1 provided one new component, the PopupMenu, and one new container, the ScrollPane. Pop-up menus are a staple of modern user interfaces, providing them fixes a serious omission. ScrollPane makes it trivial to implement scrolling and in Java 1.0, you had to do scrolling by writing your own code.
In Java 1.1, you also get menu shortcuts (for example, the ability to select menu items using the keyboard),
another standard feature of modern user interfaces.
Java 1.1 also introduced a LightweightPeer, which meant that it was possible to create lightweight components.
To do so, you subclass the Component or Container directly, which was not possible in earlier releases.
For simple operations, lightweight components are much more efficient than full-fledged components.
Java (AWT) Abstract Window Toolkit and (JFC) Java Foundation Classes
Here's the information I found about the relationship between Java (AWT) Abstract Window Toolkit and Java Foundation Classes (JFC).
- Java AWT is part of the Java Foundation Classes (JFC), which provides a way to build platform-independent graphical applications.
- Java Foundation Classes (JFC) are a graphical framework for building portable Java-based graphical user interfaces (GUIs) and consists of the Abstract Window Toolkit (AWT), Swing and Java 2D.
- AWT existed before JFC and was heavily criticized for being little more than a wrapper around the native graphical capabilities of the host platform.
- Java Foundation Classes (JFC) are pre-written code in the form of class libraries (coded routines) that give the programmer a comprehensive set of graphical user interface (GUI) routines to use.
- The Java Foundation Classes (JFC) are comparable to the Microsoft Foundation Class Library (MFC) and JFC is an extension of the original Java Abstract Windowing Toolkit (AWT).