|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cse115.graphics.AbstractGraphic
public abstract class AbstractGraphic
An abstract class that is the superclass for most graphics. Defines most capabilities that are shared among all Graphic shapes
Constructor Summary | |
---|---|
AbstractGraphic()
Creates a new instance of AbstractGraphic with a default size (0,0); location (0,0); and rotation (0) |
Method Summary | |
---|---|
void |
addMouseListener(MouseListener ml)
Adds a java.awt.event.MouseListener to this graphic |
void |
addMouseMotionListener(MouseMotionListener mml)
Adds a java.awt.event.MouseMotionListener to this graphic |
boolean |
contains(Point p)
Tests to see if the given point is contained within this shape |
Rectangle |
getBounds()
Returns the BoundingBox of this graphic |
Point |
getCenterLocation()
Gets the Center location of this graphic |
IContainer |
getContainer()
Gets the Container of this graphic |
Dimension |
getDimension()
Gets the dimension of this graphic |
Point |
getLocation()
Gets the location of this graphic |
Collection<MouseListener> |
getMouseListeners()
Gets all the java.awt.event.MouseListeners of this graphic |
Collection<MouseMotionListener> |
getMouseMotionListeners()
Gets all the java.awt.event.MouseMotionListeners of this graphic |
Integer |
getRotation()
Gets the current rotation of this graphic |
boolean |
intersects(Graphic g)
In Beta Testing Tests to see if two Graphics intersect with each other. |
void |
move(Vector v)
Moves the Graphic by a certain vector |
void |
paint(Graphics2D gs)
This gets the concrete subclasses ready to do the actual painting - it figures out a rotation, then delegates the drawing to the specific subclass |
void |
rotate(Integer degreesToRotate)
Rotates the graphic by a specific number of degrees |
void |
setCenterLocation(Point point)
Changes the center location of this graphic |
void |
setContainer(IContainer container)
Sets the Container of this Graphic. |
void |
setDimension(Dimension d)
Changes the Dimension of this Graphic |
void |
setLocation(Point point)
Changes the location of this graphic |
void |
setRotation(Integer degree)
Changes the rotation of this graphic. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface cse115.graphics.Graphic |
---|
actualPaint, getShape |
Constructor Detail |
---|
public AbstractGraphic()
Method Detail |
---|
public IContainer getContainer()
setContainer(IContainer container)
public void setContainer(IContainer container)
setContainer
in interface Graphic
container
- public void paint(Graphics2D gs)
paint
in interface Graphic
gs
- The Graphics2D object that draws the shapes on the IContainerGraphic.paint(java.awt.Graphics2D)
public void setDimension(Dimension d)
setDimension
in interface Sizeable
d
- the new DimensionSizeable.setDimension(java.awt.Dimension)
,
getDimension()
public Dimension getDimension()
getDimension
in interface Sizeable
Sizeable.getDimension()
,
setDimension(java.awt.Dimension)
public void setLocation(Point point)
setLocation
in interface Locatable
point
- The new location to put the graphicLocatable.setLocation(java.awt.Point)
public Point getLocation()
getLocation
in interface Locatable
Locatable.getLocation()
public void setCenterLocation(Point point)
setCenterLocation
in interface CenterLocatable
point
- the location to place the center of this graphic atCenterLocatable.setCenterLocation(java.awt.Point)
public Point getCenterLocation()
getCenterLocation
in interface CenterLocatable
CenterLocatable.getCenterLocation()
public void move(Vector v)
move
in interface Locatable
v
- The vector containing the amount to moveLocatable.move(cse115.utilities.Vector)
public void setRotation(Integer degree)
setRotation
in interface Rotatable
degree
- The number of degrees to set the rotation atRotatable.setRotation(java.lang.Integer)
public Integer getRotation()
getRotation
in interface Rotatable
Rotatable.getRotation()
public void rotate(Integer degreesToRotate)
rotate
in interface Rotatable
degreesToRotate
- The number of degrees to rotate this graphicRotatable.rotate(java.lang.Integer)
public void addMouseListener(MouseListener ml)
java.awt.event.MouseListener
to this graphic
addMouseListener
in interface Graphic
ml
- Graphic.addMouseListener(java.awt.event.MouseListener)
public Collection<MouseListener> getMouseListeners()
java.awt.event.MouseListeners
of this graphic
getMouseListeners
in interface Graphic
Graphic.getMouseListeners()
public void addMouseMotionListener(MouseMotionListener mml)
java.awt.event.MouseMotionListener
to this graphic
addMouseMotionListener
in interface Graphic
mml
- The java.awt.event.MouseMotionListener
to add to theGraphic.addMouseMotionListener(java.awt.event.MouseMotionListener)
public Collection<MouseMotionListener> getMouseMotionListeners()
java.awt.event.MouseMotionListeners
of this graphic
getMouseMotionListeners
in interface Graphic
Graphic.getMouseMotionListeners()
public Rectangle getBounds()
getBounds
in interface Graphic
Graphic.getBounds()
public boolean contains(Point p)
contains
in interface Graphic
p
- The point to test for containment
Graphic.contains(java.awt.Point)
public boolean intersects(Graphic g)
intersects
in interface Graphic
g
- the graphic to test for intersection
Graphic.intersects(cse115.graphics.Graphic)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |