All Packages Class Hierarchy This Package Previous Next Index
Class cs101.canvas.CS101Canvas
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----java.awt.Panel
|
+----cs101.canvas.CS101Canvas
- public class CS101Canvas
- extends Panel
-
container
-
-
CS101Canvas()
- Creates a new CS101Canvas in a new window with a white background.
-
CS101Canvas(Color)
- Creates a new CS101Canvas in a new window.
-
CS101Canvas(Container)
- Creates a new CS101Canvas with a white background.
-
CS101Canvas(Container, Color)
- Creates a new CS101Canvas.
-
add(GraphicsObject)
- Add a GraphicsObject to the drawing surface
-
addClickListener(ClickListener)
- Register a ClickLister to be informed of mouse clicks
-
addDragListener(DragListener)
- Register a DragLister to be informed of mouse drag
-
addMotionListener(MotionListener)
- Register a MotionLister to be informed of mouse motion
-
addReleaseListener(ReleaseListener)
- Register a ReleaseLister to be informed of mouse release events
-
click()
- Interactively wait for the user to click the mouse
in the drawing surface when method is called
-
getCanvasSize()
- Get the dimensions of the drawing surface
-
getHeight()
- Get the height of the drawing surface
-
getWidth()
- Get the width of the drawing surface
-
moveToBack(GraphicsObject)
- Moves the object to the back of the picture.
-
moveToFront(GraphicsObject)
- Moves the object to the front of the picture.
-
remove(GraphicsObject)
- Remove a GraphicsObject from the drawing surface
-
removeClickListener(ClickListener)
- Unregister a ClickLister
-
removeDragListener(DragListener)
- Unregister a DragLister
-
removeMotionListener(MotionListener)
- Unregister a MotionLister
-
removeReleaseListener(ReleaseListener)
- Unregister a ReleaseLister
-
setInstruction(String)
- Sets the text in the instruction text field.
-
setLabel1(String)
- Sets the text in the first label
-
setLabel2(String)
- Sets the text in the second label
-
setLabelText1(String)
- Sets the text in the first text field
-
setLabelText2(String)
- Sets the text in the second text field
-
setStatus(String)
-
-
sleep(int)
- Suspend current thread for a time
container
protected Container container
CS101Canvas
public CS101Canvas()
- Creates a new CS101Canvas in a new window with a white background.
CS101Canvas
public CS101Canvas(Color background)
- Creates a new CS101Canvas in a new window.
- Parameters:
- background - Color to set as background
CS101Canvas
public CS101Canvas(Container container)
- Creates a new CS101Canvas with a white background.
- Parameters:
- container - Container to put the new Canvas in
CS101Canvas
public CS101Canvas(Container container,
Color background)
- Creates a new CS101Canvas.
- Parameters:
- container - Container to put the new Canvas in
- background - Color to set as background
setStatus
public void setStatus(String s)
getCanvasSize
public Rectangle getCanvasSize()
- Get the dimensions of the drawing surface
- Returns:
- Rectangle object with dimensions
getWidth
public int getWidth()
- Get the width of the drawing surface
- Returns:
- int width of canvas
getHeight
public int getHeight()
- Get the height of the drawing surface
- Returns:
- int height of canvas
add
public void add(GraphicsObject gob)
- Add a GraphicsObject to the drawing surface
- Parameters:
- gob - Reference to GraphicsObject
- Returns:
- none
remove
public void remove(GraphicsObject gob)
- Remove a GraphicsObject from the drawing surface
- Parameters:
- gob - Reference to GraphicsObject
- Returns:
- none
moveToFront
public void moveToFront(GraphicsObject gob)
- Moves the object to the front of the picture.
moveToBack
public void moveToBack(GraphicsObject gob)
- Moves the object to the back of the picture.
setInstruction
public void setInstruction(String text)
- Sets the text in the instruction text field.
- Parameters:
- text - Text to be set
- Returns:
- none
setLabel1
public void setLabel1(String text)
- Sets the text in the first label
- Parameters:
- text - Text to be set
- Returns:
- none
setLabel2
public void setLabel2(String text)
- Sets the text in the second label
- Parameters:
- text - Text to be set
- Returns:
- none
setLabelText1
public void setLabelText1(String text)
- Sets the text in the first text field
- Parameters:
- text - Text to be set
- Returns:
- none
setLabelText2
public void setLabelText2(String text)
- Sets the text in the second text field
- Parameters:
- Text - to be set
- Returns:
- none
click
public Position click()
- Interactively wait for the user to click the mouse
in the drawing surface when method is called
- Returns:
- A Position where the user clicked
addMotionListener
public void addMotionListener(MotionListener x)
- Register a MotionLister to be informed of mouse motion
- Returns:
- none
removeMotionListener
public void removeMotionListener(MotionListener x)
- Unregister a MotionLister
- Returns:
- none
addDragListener
public void addDragListener(DragListener x)
- Register a DragLister to be informed of mouse drag
- Returns:
- none
removeDragListener
public void removeDragListener(DragListener x)
- Unregister a DragLister
- Returns:
- none
addClickListener
public void addClickListener(ClickListener x)
- Register a ClickLister to be informed of mouse clicks
- Returns:
- none
removeClickListener
public void removeClickListener(ClickListener x)
- Unregister a ClickLister
- Returns:
- none
addReleaseListener
public void addReleaseListener(ReleaseListener x)
- Register a ReleaseLister to be informed of mouse release events
- Returns:
- none
removeReleaseListener
public void removeReleaseListener(ReleaseListener x)
- Unregister a ReleaseLister
- Returns:
- none
sleep
public static void sleep(int milliseconds)
- Suspend current thread for a time
- Parameters:
- milliseconds - number of milliseconds to sleep
- Returns:
- none
All Packages Class Hierarchy This Package Previous Next Index