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
-
GraphicsApplet()
- Constructs a graphics applet
-
action(Event, Object)
-
-
clearWindow()
- Clears the drawing window
-
init()
-
-
keyDown(Event, int)
-
-
mouseDown(Event, int, int)
-
-
mouseMove(Event, int, int)
-
-
readDouble(String)
- Prompts user for a floating point input
-
readInt(String)
- Prompts user for an integer input
-
readMouse(String)
- Prompts user for mouse input
-
readString(String)
- Prompts user for a string input
-
run()
- Define this method in your graphics applet class to draw graphics and get user input
-
setCoord(double, double, double, double)
- Sets the coordinate system for drawing graphics
-
start()
-
-
stop()
-
GraphicsApplet
public GraphicsApplet()
- Constructs a graphics applet
start
public void start()
- Overrides:
- start in class Applet
stop
public void stop()
- Overrides:
- stop in class Applet
run
public abstract void run()
- Define this method in your graphics applet class to draw graphics and get user input
init
public void init()
- Overrides:
- init in class Applet
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
mouseMove
public boolean mouseMove(Event evt,
int x,
int y)
- Overrides:
- mouseMove in class Component
mouseDown
public synchronized boolean mouseDown(Event evt,
int x,
int y)
- Overrides:
- mouseDown in class Component
action
public synchronized boolean action(Event evt,
Object arg)
- Overrides:
- action in class Component
keyDown
public synchronized boolean keyDown(Event evt,
int key)
- Overrides:
- keyDown in class Component
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
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
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
clearWindow
public static void clearWindow()
- Clears the drawing window
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