Chapter 17 Examples


 
Pluggable Look and Feel
Windows2Motif.java demonstrates the technique used to change the current look and feel. Updated from the book to account for the move of the windows and motif packages into the plaf package. Note that the Windows and Motif look and feel classes are still in com.sun.java.swing.plaf.*.
 
Animated Icon
AnimExample.java displays an animaged Icon using the gif89 standard.
 
Custom Scrollpane Headers & Corners
HRuler.java defines a horizontal ruler. VRuler.java defines a vertical ruler. Corner.java defines a a component that triggers scrolling to a particular corner. RulerExample.java displays an image in a JScrollPane with rulers for headers and Corner objects at the corners.
 
Custom List Model
FileSystemListModel.java defines custom list model that represents the files in a directory. FileList.java displays a window with a file-based list using the command line arguments.
 
Undo
KeyEdit.java defines an undoable edit that represents a single key press. UndoExample.java displays text pane and keeps track of edits using a key listener. This example was updated from the version in the book to support a change in the select method for text field. The undo selection is moved forward rather than backwards.
 
For the Java 2 version, we changed the implementation again to match the current behavior of the text field. Also, the UndoExample class now uses the keyReleased rather than the keyTyped method to register the edit. Our installation did not notify the KeyListener of the typed event.


Copyright � 1998, John Wiley and Sons, Inc.