|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.hws.jcm.draw.Drawable
public abstract class Drawable
A Drawable object can be added to a CoordinateRect, which is itself in a DisplayCanvas. Its purpose is, generally, to draw something in the rectangular area represented by the CoordinateRect. The drawing can use information in the CoordinateRect, which includes both the real number coordinates and the pixel coordinates of the rectangular area.
Field Summary | |
---|---|
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 Summary | |
---|---|
Drawable()
|
Method Summary | |
---|---|
abstract void |
draw(java.awt.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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected CoordinateRect coords
protected DisplayCanvas canvas
Constructor Detail |
---|
public Drawable()
Method Detail |
---|
public abstract void draw(java.awt.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)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |