green,andbluepercentages (between 0.0f and 1.0f ),andthelast argument repres-
ents opacity (from 0.0f , transparent, to 1.0f , opaque).
At this point, all that's left to do is obtain the message's width and height, and use
these values to determine the location of the first message character and the baseline,
and then draw the text.
After creating this decorator, it and the view (returned from createGUI() ) are
passed to a new JLayer instance, which is installed as the content pane.
Figure 7-14 shows the resulting GUI with the centered and translucent
Figure 7-14. The UNREGISTERED message is centered within the frame window's bor-
AWTprovidesthe Canvas classwhose paint() methodcanbeoverriddentopaint
class by subclassing JComponent and overriding its paint() method, as follows:
class SwingCanvas extends JComponent
private Dimension d;
d = new Dimension(300, 300); // Create object here to