|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Indicates the basic methods that all graphical objects should implement.
All Graphics have the ability to react when clicked on with
the mouse. In addition they know how to paint themselves on the screen,
hide themselves, show themselves, change their
DrawingPanel, rotate, and determine
if another Graphic intersects with them.
| Method Summary | |
boolean |
contains(Point p)
Determine whether this Graphic's bounding rectangle
contains the passed in Point. |
Rectangle |
getBounds()
Return a copy of this Graphic's bounding rectangle. |
Point |
getCenterLocation()
Return a Point that represents the center of the Graphic. |
DrawingPanel |
getDrawingPanel()
Get the DrawingPanel where this Graphic is
being drawn. |
void |
hide()
Set the Graphic so it does not paint. |
boolean |
intersects(Graphic g)
Determine whether another Graphic's bounding rectangle
intersects with this Graphic's bounding rectangle |
void |
paint(Graphics2D g)
Normal users need not call this method! |
void |
setDrawingPanel(DrawingPanel dp)
Set the DrawingPanel where this Graphic should
be drawn. |
void |
show()
Set the Graphic so it paints. |
| Methods inherited from interface NGP.Reactor |
react |
| Methods inherited from interface java.awt.event.MouseListener |
mouseClicked, mouseEntered, mouseExited, mousePressed, mouseReleased |
| Methods inherited from interface java.awt.event.MouseMotionListener |
mouseDragged, mouseMoved |
| Methods inherited from interface NGP.Rotatable |
getRotation, setRotation |
| Method Detail |
public void paint(Graphics2D g)
Using the passed in Graphics2D paint this
Graphic.
g - the Graphics2D to use when paintingpublic void hide()
Graphic so it does not paint.
public void show()
Graphic so it paints.
public void setDrawingPanel(DrawingPanel dp)
DrawingPanel where this Graphic should
be drawn.
dp - the DrawingPanel to usegetDrawingPanelpublic DrawingPanel getDrawingPanel()
DrawingPanel where this Graphic is
being drawn.
Graphic's DrawingPanelsetDrawingPanelpublic boolean contains(Point p)
Graphic's bounding rectangle
contains the passed in Point. One use of his method
is to determine if a Graphic should react.
p - the Point to check for containment
true if the Point is contained,
false otherwisepublic boolean intersects(Graphic g)
Graphic's bounding rectangle
intersects with this Graphic's bounding rectangle
true if it does intersect, false
if notgetBoundspublic Rectangle getBounds()
Graphic's bounding rectangle.
Every Graphic uses has a bounding rectangle to help define its space.
public Point getCenterLocation()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||