J2EEOnline
GofPatterns OOPortal
prev next prev next
  Course navigation
 
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:
Draw Images
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);
}
Draw Images Exercise
Click the Exercise link to load and draw images.
Draw Images Exercise
Slideshow Applet - Exercise
Once you mastered loading and drawing images, one will be ready to start building your interactive slide show applet.
Slideshow Applet - Exercise
  Course navigation