graphics
Interface IGraphic

All Superinterfaces:
CenterLocatable, ILocatable, IRotatable, ISizeable
All Known Subinterfaces:
IColorableGraphic
All Known Implementing Classes:
AbstractColorableGraphic, AbstractGraphic, BouncingBall, BouncingBall, BouncingSquare, BouncingSquare, BouncingTriangle, BouncingTriangle, Breakout, CompoundGraphic, Earth, Elephant, Ellipse, Fish, FramedEllipse, FramedRectangle, Image, Polygon, Rectangle, Rectangle3D, TripleShape

public interface IGraphic
extends ISizeable, CenterLocatable, IRotatable

The interface that defines the capabilites for an object that is a Graphic

Author:
Michael Kozelsky Created on: Jul 27, 2006 Graphic.java

Method Summary
 void actualPaint(Graphics2D gs, Point location, Dimension dimension)
          This method uses the Graphics2D object to paint the actual shape onto the Container.
 void addMouseListener(MouseListener ml)
          Adds a java.awt.event.MouseListener onto this graphic TODO: remove mouse listener?
 void addMouseMotionListener(MouseMotionListener mml)
          Adds a java.awt.event.MouseMotionListener onto this graphic TODO: remove listener?
 boolean contains(Point p)
          Checks whether a given point is contained within this graphic
 Rectangle getBounds()
          Returns the bounding box of this graphic
 IContainer getContainer()
           
 Collection<MouseListener> getMouseListeners()
          Returns all the java.awt.event.MouseListeners of this graphic
 Collection<MouseMotionListener> getMouseMotionListeners()
          Returns all the java.awt.event.MouseMotionListeners of this graphic
 Shape getShape()
          Should return a java.awt.Shape representation of this graphic.
 boolean intersects(IGraphic shape)
          In Beta Testing Tests to see if two Graphics intersect with each other.
 void paint(Graphics2D gs)
          This method uses the Graphics2D object to paint itself onto its container
 void setContainer(IContainer container)
          This sets the container of this graphic
 void setMovement(IGraphicMovement movement)
          Sets the movement of the Graphic.
 
Methods inherited from interface graphics.ISizeable
getDimension, setDimension
 
Methods inherited from interface graphics.CenterLocatable
getCenterLocation, setCenterLocation
 
Methods inherited from interface graphics.ILocatable
getLocation, move, setLocation
 
Methods inherited from interface graphics.IRotatable
getRotation, rotate, setRotation
 

Method Detail

setContainer

void setContainer(IContainer container)
This sets the container of this graphic

Parameters:
container - the container which will contain this graphic

getBounds

Rectangle getBounds()
Returns the bounding box of this graphic

Returns:
a java.awt.Rectangle representing the bounds

contains

boolean contains(Point p)
Checks whether a given point is contained within this graphic

Parameters:
p - The point to check
Returns:
true if this graphic contains p false if not

getShape

Shape getShape()
Should return a java.awt.Shape representation of this graphic. The shape is used as a delegate for the methods: contains, intersects, etc.

Returns:
a java.awt.Shape

paint

void paint(Graphics2D gs)
This method uses the Graphics2D object to paint itself onto its container

Parameters:
gs - The Graphics2D object used to do the painting

actualPaint

void actualPaint(Graphics2D gs,
                 Point location,
                 Dimension dimension)
This method uses the Graphics2D object to paint the actual shape onto the Container.

Parameters:
gs - The Graphics2D object used to do the painting
location - The offset at which to paint this graphic
dimension - The dimension this graphic

addMouseListener

void addMouseListener(MouseListener ml)
Adds a java.awt.event.MouseListener onto this graphic TODO: remove mouse listener?

Parameters:
ml - The java.awt.event.MouseListener to listen on this graphic

getMouseListeners

Collection<MouseListener> getMouseListeners()
Returns all the java.awt.event.MouseListeners of this graphic

Returns:
Returns a collection containing all the java.awt.event.MouseListeners of this graphic

addMouseMotionListener

void addMouseMotionListener(MouseMotionListener mml)
Adds a java.awt.event.MouseMotionListener onto this graphic TODO: remove listener?

Parameters:
mml - The java.awt.event.MouseMotionListener to listen on this graphic

getMouseMotionListeners

Collection<MouseMotionListener> getMouseMotionListeners()
Returns all the java.awt.event.MouseMotionListeners of this graphic

Returns:
Returns a collection containing all the java.awt.event.MouseMotionListeners of this graphic

intersects

boolean intersects(IGraphic shape)
In Beta Testing Tests to see if two Graphics intersect with each other.

Parameters:
shape - the graphic to test for intersection
Returns:
true if this graphic intersects with g

getContainer

IContainer getContainer()

setMovement

void setMovement(IGraphicMovement movement)
Sets the movement of the Graphic. A movement should be a definition of how this will react to the move() method.

Parameters:
movement -