Basic HTML version of Foils prepared 18 May 97

Foil 22 Image Downloading -- imageObserver, MediaTracker

From Java Tutorial - Spring 1997 Part 3:Graphics and the Abstract Windowing Toolkit Peking Tutorial, Web Certificate -- Spring-Summer 1997. by Nancy J. McCracken,Geoffrey C. Fox


1 When drawImage is called, it draws only the pixels of the image that are already available.
2 Then it creates a thread for the imageObserver. Whenever more of the image becomes available, it activates the method imageUpdate, which in turn which call paint and drawImage, so that more of the image should show on the screen.
3 The default imageUpdate doesn't work if you are double buffering the window in which the image appears.
4 More control over showing the image as it downloads can be obtained by working with the MediaTracker class, using methods which can tell you when the image has fully arrived.
  • Another method is prepareImage(MyImage, this);
  • which returns a boolean that is true when image is fully downloaded.

in Table To:


© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Thu Jan 8 1998