wheelsunh.etc
Interface CustomGraphic

All Known Implementing Classes:
AbstractGraphic, AbstractShape, ConversationBubble, Ellipse, FilterInputBox, Image, InputBox, IntInputBox, Line, Rectangle, RectangularShape, RoundedRectangle, Shape, ShapeGroup, TextBox, TextInputBox

public interface CustomGraphic

Interface for everything that is to be drawn on a DrawingPanel.


Method Summary
 boolean contains(java.awt.Point p)
          If you are going to deal with mouse input, this function must return true if the passed-in point is within the bounds of the graphic and false otherwise.
 void mouseClicked(java.awt.event.MouseEvent e)
          Called when mouse is clicked over the graphic.
 void mouseDragged(java.awt.event.MouseEvent e)
          Called when mouse button is pressed and dragged over graphic.
 void mousePressed(java.awt.event.MouseEvent e)
          Called when a mouse button is pressed over the graphic.
 void mouseReleased(java.awt.event.MouseEvent e)
          Called when a mouse button is released over the graphic.
 void paint(java.awt.Graphics2D g)
          The real meat of the interface.
 

Method Detail

paint

void paint(java.awt.Graphics2D g)
The real meat of the interface. The graphic must know how to draw itself using the passed-in instance of Graphics2D. This method will be called often (whenever the containing drawing panel is repainted).

Parameters:
g - the Graphics2D you should use to paint your graphic

contains

boolean contains(java.awt.Point p)
If you are going to deal with mouse input, this function must return true if the passed-in point is within the bounds of the graphic and false otherwise. If you are not using mouse interaction, you can just return false.

Parameters:
p - the point

mousePressed

void mousePressed(java.awt.event.MouseEvent e)
Called when a mouse button is pressed over the graphic.


mouseReleased

void mouseReleased(java.awt.event.MouseEvent e)
Called when a mouse button is released over the graphic.


mouseClicked

void mouseClicked(java.awt.event.MouseEvent e)
Called when mouse is clicked over the graphic.


mouseDragged

void mouseDragged(java.awt.event.MouseEvent e)
Called when mouse button is pressed and dragged over graphic.