
Figur e 3−2: Swing bor der styles
ally. Its
paintIcon() method is called to display the graphic, and this method can
do anything necessary to display it.
Swing includes an
Icon implementation called ImageIcon. This commonly used
class is an
Image-based implementation of Icon. ImageIcon also simplifies the pro-
cess of reading images from external files. One of the constructors for
ImageIcon
simply takes the name of the desired image file.
Arelated utility function is the static method
GrayFilter.createDisabledImage().
This version produces a grayed-out version of a given
Image, which can be used
to create an
ImageIcon that repr esents a disabled action or capability.
Cur sor s
The cursor, or mouse pointer, is the graphic that appears on the screen and tracks
the position of the mouse. Java support for cursors has evolved in each Java
release. Java 1.0 and 1.1 included 14 predefined cursors but did not support cus-
tom cursors. In Java 1.0, the predefined cursors were repr esented by constants
defined by
java.awt.Frame and they could be specified only for these top-level
Frame components. These Frame constants and the corresponding setCursor()
method of Frame ar e now deprecated.
Swing Prog.
Topics
Cursors 35
13 September 1999 17:55