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 ...

Get Graphic Java™ 1.2, Volume I: AWT, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.