graphics
Interface IGraphic

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

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(java.awt.Graphics2D gs, java.awt.Point location, java.awt.Dimension dimension)
          This method uses the Graphics2D object to paint the actual shape onto the Container.
 void addMouseListener(java.awt.event.MouseListener ml)
          Adds a java.awt.event.MouseListener onto this graphic TODO: remove mouse listener?
 void addMouseMotionListener(java.awt.event.MouseMotionListener mml)
          Adds a java.awt.event.MouseMotionListener onto this graphic TODO: remove listener?
 boolean contains(java.awt.Point p)
          Checks whether a given point is contained within this graphic
 java.awt.Rectangle getBounds()
          Returns the bounding box of this graphic
 IContainer getContainer()
          Get the Container this graphic is in.
 java.util.Collection<java.awt.event.MouseListener> getMouseListeners()
          Returns all the java.awt.event.MouseListeners of this graphic
 java.util.Collection<java.awt.event.MouseMotionListener> getMouseMotionListeners()
          Returns all the java.awt.event.MouseMotionListeners of this graphic
 IGraphicMovement getMovement()
          Returns this graphic's movement
 java.awt.Shape getShape()
          Should return a java.awt.Shape representation of this graphic.
 boolean intersects(IGraphic shape)
          Tests to see if two Graphics intersect with each other.
 void paint(java.awt.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

java.awt.Rectangle getBounds()
Returns the bounding box of this graphic

Returns:
a java.awt.Rectangle representing the bounds

contains

boolean contains(java.awt.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

java.awt.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(java.awt.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(java.awt.Graphics2D gs,
                 java.awt.Point location,
                 java.awt.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(java.awt.event.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

java.util.Collection<java.awt.event.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(java.awt.event.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

java.util.Collection<java.awt.event.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)
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()
Get the Container this graphic is in. May return null if this graphic has not been added to anything

Returns:
this graphics' container

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(utilities.Vector) method.

Parameters:
movement -

getMovement

IGraphicMovement getMovement()
Returns this graphic's movement

Returns:
An IMovement