9.12. Drawing Images
Applets and applications written in the Java programming language can load and display static images in GIF or JPEG format, as well as GIF89A images (a.k.a. “animated GIF”).
Image drawing is done in two steps. First, a remote or local image is registered by means of the getImage method of Applet or Toolkit. Second, the image is drawn on the screen with the drawImage method of Graphics. You can draw the image at its regular size or supply an explicit width and height. The key point to remember is that calls to getImage don't actually initiate image loading. Instead, Java technology doesn't start loading the image until it is needed.
Actual loading of the image is done in a background thread, and the image can be drawn incrementally ...
Get Core Web Programming, Second 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.