
182
|
Chapter 5, Windows, Dialogs, and Frames
#35 Add Windows Resize Icons
HACK
Icon is pretty simple, and it has only three methods:
void paintIcon(Component c, Graphics g, int x, int y);
int getIconWidth( );
int getIconHeight( );
The getIconWidth( ) and getIconHeight( ) methods should be pretty easy to
implement—you just need the pixel size of your custom icons. The
paintIcon( ) method is where all the interesting stuff happens.
The Explorer Icon
Figure 5-4 shows a huge blowup of what we’ll call the Explorer icon.
At a glance, you can see the six squares in a triangular pattern with a subtle
white 3D effect on the squares. The easiest thing to handle is the size, so
start with that. This icon is 12 × 12 pixels (one square in Figure 5-4 equals
one pixel).
Figure 5-2. The Windows Explorer resize icon
Figure 5-3. The Windows MS Office resize icon