Class chap5.ch5_fig18
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class chap5.ch5_fig18

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----java.applet.Applet
                                   |
                                   +----chap5.ch5_fig18

public final class ch5_fig18
extends Applet
implements Runnable
A class that displays a grid (via FlowLayout) of images whose URLs are passed in from the HTML page. While the images are being loaded, we display expanding circles in the spaces the images would occupy. Example of ImageObserver use.

Variable Index

 o ImageName
 o bImageLoadingError
 o current

Method Index

 o init()
Create the image name Vector, then fill it with Image parameters retrieved from the HTML page.
 o paint(Graphics)
Paint the applets display space.
 o run()
The main loop for this thread.
 o start()
start - Whenever a user visits our page, Applet calls this.
 o stop()
Stop this thread.

Variables

 o bImageLoadingError
  public boolean bImageLoadingError
 o ImageName
  public Vector ImageName
 o current
  public static ch5_fig18 current

Methods

 o start
  public void start()
start - Whenever a user visits our page, Applet calls this. This is an override of an Applet method. Creates a thread and passes this AgentLauncher into it. Works because we implement the Runnable method.
Overrides:
start in class Applet
 o stop
  public void stop()
Stop this thread.
Overrides:
stop in class Applet
 o run
  public synchronized void run()
The main loop for this thread. Sleep for 1/3 second, then repaint all the panels. Only runs for as long as it takes for the images to load.
 o init
  public void init()
Create the image name Vector, then fill it with Image parameters retrieved from the HTML page. Create Panel array.
Overrides:
init in class Applet
 o paint
  public void paint(Graphics g)
Paint the applets display space. Repaints each of the Panels. Checks whether all the images have been displayed. If so, it kills the thread that called this by setting myThread to null. This method will STILL get called by the browser whenever it needs to repaint this window.
Overrides:
paint in class Component

All Packages  Class Hierarchy  This Package  Previous  Next  Index