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

AWT Components as Image Observers

As alluded to earlier, when an AWT component is specified as an image observer, java.awt.Component.imageUpdate() is invoked by the image's image producer—provided, of course, that the method has not been overridden in a subclass. None of the components provided by the AWT overrides imageUpdate(); all exhibit the behavior of Component.imageUpdate(), which is listed in Example 5-10.

Example 5-10. java.awt.Component.imageUpdate()
 public boolean imageUpdate(Image img, int flags, int x, int y, int w, int h) { int rate = -1; if ((flags & (FRAMEBITS|ALLBITS)) != 0) { rate = 0; } else if ((flags & SOMEBITS) != 0) { if (isInc) { try { rate = incRate; if (rate < 0) rate = 0; } catch (Exception e) { rate = 100; } } } if ...

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