All Packages  Class Hierarchy  This Package  Previous  Next  Index


Class cs005.app.App

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----java.applet.Applet
                                   |
                                   +----cs005.app.App


public class App
extends Applet
implements Runnable
Last modified: 6/8/97 6:42pm
Authors: stp, sco

This is the cs4/cs5 wrapper around java.applet.Applet. It handles a lot of the offscreen buffering. In order to copy the offscreen buffer to the onscreen image, call either showDrawn or repaint, when you have finished drawing whatever it is you want to be shown on screen. This prevents a lot of flickering.

The App also creates a KeyPressManager to deal with keystrokes.


Constructor Index

o App()
Constructor: App

Empty constructor.

Method Index

o getGraphics()
Method: getGraphics

This method is redefined to return the offscreen buffer.

o getManager()
Method: getManager

This method is called by the KeyInteractors to access the KeyPressManager.

o init()
Method: init

This method is called automatically by the appletViewer after the constructor is called.

o paint(Graphics)
Method: paint

This method draws the offscreen buffer onto the Graphics object that was passed to the method.

o repaint()
Method: repaint

This overrides Container.repaint and will copy the offscreen buffer to the onscreen buffer.

o run()
Method: run

This method is called by the thread running in the background.

o showDrawn()
Method: showDrawn

This method will copy the offscreen buffer to the onscreen buffer.

o start()
Method: start

This method is called automatically by the appletViewer after the init() method is called.

o stop()
Method: stop

This method destroys the thread that is running in the backrground.

Constructors

o App

  public App()
Constructor: App

Empty constructor.

Methods

o init

  public void init()
Method: init

This method is called automatically by the appletViewer after the constructor is called.
It sets the background, and creates the offscreen buffer and KeyPressManager.

Overrides:
init in class Applet

o start

  public void start()
Method: start

This method is called automatically by the appletViewer after the init() method is called.
It starts up a thread that runs in the background.

Overrides:
start in class Applet

o stop

  public void stop()
Method: stop

This method destroys the thread that is running in the backrground. At this time calling stop has no effect on the App.

Overrides:
stop in class Applet

o paint

  public void paint(Graphics g)
Method: paint

This method draws the offscreen buffer onto the Graphics object that was passed to the method.

Parameters:
Graphics - object
Overrides:
paint in class Component

o getGraphics

  public Graphics getGraphics()
Method: getGraphics

This method is redefined to return the offscreen buffer.

Returns:
the Offscreen buffer's graphics object
Overrides:
getGraphics in class Component

o showDrawn

  public void showDrawn()
Method: showDrawn

This method will copy the offscreen buffer to the onscreen buffer.

o run

  public void run()
Method: run

This method is called by the thread running in the background.
Unfortunately, it is empty

o repaint

  public void repaint()
Method: repaint

This overrides Container.repaint and will copy the offscreen buffer to the onscreen buffer.

Overrides:
repaint in class Component

o getManager

  public KeyPressManager getManager()
Method: getManager

This method is called by the KeyInteractors to access the KeyPressManager.

Returns:
the KeyPressManager


All Packages  Class Hierarchy  This Package  Previous  Next  Index