Chapter 2 Examples


Tooltips

These examples demonstrates two techniques with tool tips. ButtonToolTips.java shows how you can add a tool tip to a button. ToolTips.java implement a JPanel subclass that displays custom tool tips based on the mouse location.

Swing in Windows

Simple_Window.java is an application that uses a JFrame to display a message to the user.

Window Events

Windows.java uses a WindowListener to handle the close box. The listener also prints messages as WindowListener methods are called. MeanWindow.java uses a WindowListener to handle the close box based on a random decision.

Swing in Applets

Simple_Applet.java defines a subclass of JApplet that displays a message to the user.


Copyright © 1998, John Wiley and Sons, Inc.