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
-
GraphicsObject(int, int, int, int, Color)
- Constructs a new GraphicsObject
-
animateMove(int, int, double, double)
-
-
draw(Graphics)
-
-
getHeight()
- Get the height of the GraphicsObject
-
getPosition()
- Get the x and y coordinate of the top left
corner of the GraphicsObject as a Position
-
getWidth()
- Get the width of the GraphicsObject
-
getX()
- Get the x coordinate of the GraphicsObject
-
getY()
- Get the y coordinate of the GraphicsObject
-
move(int, int)
- Move the GraphicsObject according to the top
left corner
-
moveCenter(int, int)
- Move the center of the GraphicsObject
-
repaint()
-
-
setCanvas(GraphicsCanvas)
-
-
setColor(Color)
- Set the color of the GraphicsObject
-
toString()
-
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
setCanvas
public static void setCanvas(GraphicsCanvas canvas)
getX
public int getX()
- Get the x coordinate of the GraphicsObject
- Returns:
- integer value of the x coordinate
getY
public int getY()
- Get the y coordinate of the GraphicsObject
- Returns:
- integer value of the y coordinate
getWidth
public int getWidth()
- Get the width of the GraphicsObject
- Returns:
- integer value of the width
getHeight
public int getHeight()
- Get the height of the GraphicsObject
- Returns:
- integer value of the height
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
setColor
public void setColor(Color graphicsColor)
- Set the color of the GraphicsObject
- Parameters:
- graphicsColor - color of the object
- Returns:
- none
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
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
animateMove
public void animateMove(int x,
int y,
double velocity,
double update_rate)
repaint
public final void repaint()
toString
public String toString()
- Overrides:
- toString in class Object
draw
public abstract void draw(Graphics g)
All Packages Class Hierarchy This Package Previous Next Index