ImageObserver is em interface used to receive notification as an image is being' defines only one method: imagcUpdate(). Using an image observer allows you t.o perform other actions; such as show a progress indicator or an attract screen" as 'you arc informed of the progress of the download. This kind of notification isvery useful when an image is being loaded over th~ network where the content designer rarely appreciates that people are often trying to load applets Tera slow modem.
The.imageUpdate() method has this-general form boolean imageUpdate(Imaging Obj Int Flags, int left int int width int height) Here imgObj is the image being loaded, and flags is an' integer that communicates the status of the update report. The four Integers left, top, widt and height zt represent a rectangle tlv contains different values depending on the values passed in flags. Update( ) should return false if it has completed loading, and true if there is more image to process The flags parameter contains one or more bit flags defined 'as static variables inside' .the ImageObserver interface. These flags and the information th=v provide are listed The Applet class has an implementation of the image Update method for the ImageObserver interface that is used to repaint images as they are loaded. ,YOU can override this method' in your class to change that behavior.Here is .a simple example of an Image lf pdatef.) method:

Share This