O'Reilly logo

Graphic Java™ 1.2, Volume I: AWT, Third Edition by David M. Geary

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Painting Images a Scanline at a Time

Example 5-5 lists an applet that which is a variation of the previous applet. Instead of calling repaint() after all the bits have been loaded into the image, the applet calls repaint() every time imageUpdate() is called.

Example 5-5. Image Loading With Dynamic Updates
 import java.applet.Applet; import java.awt.Graphics; import java.awt.Image; public class ImageTestAppletWithDynamicUpdate extends Applet { private Image im; public void init() { im = getImage(getCodeBase(), "saint.gif"); System.out.print ("Image width=" + im.getWidth(this)); System.out.println(" height=" + im.getHeight(this)); } public void ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required