Class ccj.GraphicsApplet
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ccj.GraphicsApplet

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----java.applet.Applet
                                   |
                                   +----ccj.GraphicsApplet

public class GraphicsApplet
extends Applet
implements Runnable

Constructor Index

 o GraphicsApplet()
Constructs a graphics applet

Method Index

 o action(Event, Object)
 o clearWindow()
Clears the drawing window
 o init()
 o keyDown(Event, int)
 o mouseDown(Event, int, int)
 o mouseMove(Event, int, int)
 o readDouble(String)
Prompts user for a floating point input
 o readInt(String)
Prompts user for an integer input
 o readMouse(String)
Prompts user for mouse input
 o readString(String)
Prompts user for a string input
 o run()
Define this method in your graphics applet class to draw graphics and get user input
 o setCoord(double, double, double, double)
Sets the coordinate system for drawing graphics
 o start()
 o stop()

Constructors

 o GraphicsApplet
  public GraphicsApplet()
Constructs a graphics applet

Methods

 o start
  public void start()
Overrides:
start in class Applet
 o stop
  public void stop()
Overrides:
stop in class Applet
 o run
  public abstract void run()
Define this method in your graphics applet class to draw graphics and get user input
 o init
  public void init()
Overrides:
init in class Applet
 o readMouse
  public synchronized Point readMouse(String s)
Prompts user for mouse input
Parameters:
s - the prompt string
Returns:
the position at which the user clicked the mouse in response
 o mouseMove
  public boolean mouseMove(Event evt,
                           int x,
                           int y)
Overrides:
mouseMove in class Component
 o mouseDown
  public synchronized boolean mouseDown(Event evt,
                                        int x,
                                        int y)
Overrides:
mouseDown in class Component
 o action
  public synchronized boolean action(Event evt,
                                     Object arg)
Overrides:
action in class Component
 o keyDown
  public synchronized boolean keyDown(Event evt,
                                      int key)
Overrides:
keyDown in class Component
 o readString
  public static String readString(String s)
Prompts user for a string input
Parameters:
s - the prompt string
Returns:
the string the user typed in response
 o readInt
  public static int readInt(String s)
Prompts user for an integer input
Parameters:
s - the prompt string
Returns:
the integer the user typed in response
 o readDouble
  public static double readDouble(String s)
Prompts user for a floating point input
Parameters:
s - the prompt string
Returns:
the floating point number the user typed in response
 o clearWindow
  public static void clearWindow()
Clears the drawing window
 o setCoord
  public void setCoord(double xleft,
                       double ytop,
                       double xright,
                       double ybottom)
Sets the coordinate system for drawing graphics
Parameters:
xleft - the x coordinate of the left border
ytop - the y coordinate of the top border
xright - the x coordinate of the right border
ybottom - the y coordinate of the bottom border

All Packages  Class Hierarchy  This Package  Previous  Next  Index