|
||
|
Lesson 7
Objective
|
Drawing images Draw images. |
|
|
Drawing images in Java is very straightforward. To draw an image, you use one of the drawImage() methods defined in
the Graphics class. Following is the simplest of the drawImage() methods:
The Applet class implements the ImageObserver interface, so you can pass it along as the last parameter, as
the following example demonstrates:
public void paint(Graphics g) { g.drawImage(img, 20, 20, this); }
Click the Exercise link to load and draw images.
Slideshow Applet - Exercise
Draw Images Exercise
Once you mastered loading and drawing images, one will be ready to start building your interactive slide show applet.
Slideshow Applet - Exercise |
||
|
|
||
