![]() |
![]() |
![]() |
![]() |
![]() |
|
To see what the Meter class's paint method draws, you have to
attach a Meter class instance to a
frame's content pane.
To retrieve the content pane from a frame, you use the
getContentPane method with the frame as the target and no
arguments. To attach a component to the retrieved content
pane, you use the add method with the content pane as the target
and two arguments:
getContentPane().add("Center", meter);
The first argument of the add method stipulates where the
component is to be placed relative to the content pane,
which occupies the entire window, except for space occupied by the menu
bar, if any. The second argument supplies the component
itself.