 |
 |
 |
 |
 |
|
|
Roll
your own ImageCanvas
|
|
|
|
|
 |
 |
 |
 |
 |
 |
class ImageCanvas extends Component {
|
|
Image
image;
|
|
|
ImageCanvas(Image image)
|
|
|
{this.image = image;}
|
|
|
public
void paint(Graphics g)
|
|
|
{
g.drawImage(image, 0, 0, this);}
|
|
|
}
|
|
|
|
|
|
 |
 |
 |
Paint
is called whenever a component must be shown,
|
|
the
Graphics object does the actual drawing, it has to be
|
passed
in because it is what knows about physically
|
|
drawing on the
screen
|
|
|
|
|