All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class cs101.canvas.GraphicsObject

java.lang.Object
   |
   +----cs101.canvas.GraphicsObject

public abstract class GraphicsObject
extends Object
A drawable object for GraphicsCanvas


Constructor Index

 o GraphicsObject(int, int, int, int, Color)
Constructs a new GraphicsObject

Method Index

 o animateMove(int, int, double, double)
 o draw(Graphics)
 o getHeight()
Get the height of the GraphicsObject
 o getPosition()
Get the x and y coordinate of the top left
corner of the GraphicsObject as a Position
 o getWidth()
Get the width of the GraphicsObject
 o getX()
Get the x coordinate of the GraphicsObject
 o getY()
Get the y coordinate of the GraphicsObject
 o move(int, int)
Move the GraphicsObject according to the top
left corner
 o moveCenter(int, int)
Move the center of the GraphicsObject
 o repaint()
 o setCanvas(GraphicsCanvas)
 o setColor(Color)
Set the color of the GraphicsObject
 o toString()

Constructors

 o GraphicsObject
 public GraphicsObject(int x,
                       int y,
                       int width,
                       int height,
                       Color graphicsColor)
Constructs a new GraphicsObject

Parameters:
x - x coordinate of left side
y - y coordinate of top side
width - width of object
height - height of object
graphicsColor - color of object
Returns:
none

Methods

 o setCanvas
 public static void setCanvas(GraphicsCanvas canvas)
 o getX
 public int getX()
Get the x coordinate of the GraphicsObject

Returns:
integer value of the x coordinate
 o getY
 public int getY()
Get the y coordinate of the GraphicsObject

Returns:
integer value of the y coordinate
 o getWidth
 public int getWidth()
Get the width of the GraphicsObject

Returns:
integer value of the width
 o getHeight
 public int getHeight()
Get the height of the GraphicsObject

Returns:
integer value of the height
 o getPosition
 public Position getPosition()
Get the x and y coordinate of the top left
corner of the GraphicsObject as a Position

Returns:
Position of the top left corner
See Also:
Position
 o setColor
 public void setColor(Color graphicsColor)
Set the color of the GraphicsObject

Parameters:
graphicsColor - color of the object
Returns:
none
 o move
 public void move(int x,
                  int y)
Move the GraphicsObject according to the top
left corner

Parameters:
x - new x coordinate
y - new y coordinate
Returns:
none
 o moveCenter
 public void moveCenter(int x,
                        int y)
Move the center of the GraphicsObject

Parameters:
x - new x coordinate of the center
y - new y coordinate of the center
Returns:
none
 o animateMove
 public void animateMove(int x,
                         int y,
                         double velocity,
                         double update_rate)
 o repaint
 public final void repaint()
 o toString
 public String toString()
Overrides:
toString in class Object
 o draw
 public abstract void draw(Graphics g)

All Packages  Class Hierarchy  This Package  Previous  Next  Index