public abstract class Drawable extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
protected DisplayCanvas |
canvas
The canvas on which this Drawable is drawn.
|
protected CoordinateRect |
coords
The CoordinateRect for the rectagular area where this
Drawable is drawn.
|
Constructor and Description |
---|
Drawable() |
Modifier and Type | Method and Description |
---|---|
abstract void |
draw(Graphics g,
boolean coordsChanged)
Draw this drawable in the graphics context g.
|
boolean |
getVisible()
Return true if this Drawable is visible, false if it is hidden.
|
void |
needsRedraw()
This routine should be called if the appearance of the Drawable changes
so that the rectangular area that it occupies has to be redrawn.
|
protected void |
setOwnerData(DisplayCanvas canvas,
CoordinateRect coords)
Sets the values of member variables canvas and coords.
|
void |
setVisible(boolean show)
Set the visibility of this Drawable.
|
protected CoordinateRect coords
protected DisplayCanvas canvas
public abstract void draw(Graphics g, boolean coordsChanged)
g
- The graphics context in which the Drawble is to be drawn. (The drawing
can change the color in g, but should not permanently change font, painting mode, etc.
Thus, every drawable is responsible for setting the color it wants to use.)coordsChanged
- Indicates whether the CoordinateRect has changed.public boolean getVisible()
public void setVisible(boolean show)
public void needsRedraw()
protected void setOwnerData(DisplayCanvas canvas, CoordinateRect coords)