|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
containers.Panel
graphics.DrawingCanvas
public class DrawingCanvas
This is a Panel that acts as a container for Graphics. Place graphics onto this.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
JComponent.AccessibleJComponent |
| Field Summary |
|---|
| Fields inherited from class javax.swing.JComponent |
|---|
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
DrawingCanvas()
Creates a new instance of DrawingCanvas with no Graphics on it. |
|
| Method Summary | |
|---|---|
void |
add(IGraphic g)
Adds a Graphic onto the DrawingCanvas. |
Collection<IGraphic> |
getAllGraphics()
Gets a Collection of all the Graphics on this DrawingCanvas |
Point |
getCenterLocation()
Gets the center of the DrawingCanvas |
void |
mouseClicked(MouseEvent e)
Called when the mouse is clicked on the DrawingCanvas, delegates to the appropriate Graphic |
void |
mouseDragged(MouseEvent e)
|
void |
mouseEntered(MouseEvent e)
Called when the mouse is entered onto the DrawingCanvas, does nothing |
void |
mouseExited(MouseEvent e)
Called when the mouse exits the DrawingCanvas, does nothing |
void |
mouseMoved(MouseEvent e)
Called when the mouse was moved on the DrawingCanvas, calls entered, exited, moved on appropriate graphics |
void |
mousePressed(MouseEvent e)
Called when the mouse is pressed on the DrawingCanvas, delegates to the appropriate Graphic |
void |
mouseReleased(MouseEvent e)
Called when the mouse is released on the DrawingCanvas, delegates to the appropriate Graphic |
void |
paintComponent(Graphics gs)
Partially overrides the paint method to paint all of it's graphics as well as itself |
Point |
randomPoint()
Find a random point on this DrawingCanvas |
void |
remove(IGraphic g)
Removes a Graphic from the DrawingCanvas. |
void |
removeAllGraphics()
Removes all the graphics from this DrawingCanvas, making it empty. |
void |
setLocation(Point p)
Sets the Location of this DrawingCanvas to a specified point. |
| Methods inherited from class containers.Panel |
|---|
getColor, getDimension, setColor, setDimension |
| Methods inherited from class javax.swing.JPanel |
|---|
getAccessibleContext, getUI, getUIClassID, setUI, updateUI |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface graphics.IContainer |
|---|
getDimension, repaint, repaint |
| Methods inherited from interface java.awt.image.ImageObserver |
|---|
imageUpdate |
| Methods inherited from interface graphics.ISizeable |
|---|
getDimension, setDimension |
| Constructor Detail |
|---|
public DrawingCanvas()
| Method Detail |
|---|
public void mouseClicked(MouseEvent e)
mouseClicked in interface MouseListenere - The MouseEvent that did the clickingMouseListener.mouseClicked(java.awt.event.MouseEvent)public void mousePressed(MouseEvent e)
mousePressed in interface MouseListenere - The MouseEvent that did the pressingMouseListener.mousePressed(java.awt.event.MouseEvent)public void mouseReleased(MouseEvent e)
mouseReleased in interface MouseListenere - The MouseEvent that did the releasingMouseListener.mouseReleased(java.awt.event.MouseEvent)public void mouseEntered(MouseEvent e)
mouseEntered in interface MouseListenere - The MouseEvent that did the enteringMouseListener.mouseEntered(java.awt.event.MouseEvent)public void mouseExited(MouseEvent e)
mouseExited in interface MouseListenere - The MouseEvent that did the exitingMouseListener.mouseExited(java.awt.event.MouseEvent)public void mouseDragged(MouseEvent e)
mouseDragged in interface MouseMotionListenere - MouseMotionListener.mouseDragged(java.awt.event.MouseEvent)public void mouseMoved(MouseEvent e)
mouseMoved in interface MouseMotionListenere - The MouseEvent that did the movingMouseMotionListener.mouseMoved(java.awt.event.MouseEvent)public void setLocation(Point p)
setLocation in class Componentp - The Point at which to place this DrawingCanvasComponent.setLocation(java.awt.Point)public Point getCenterLocation()
public void add(IGraphic g)
add in interface IContainerg - The Graphic to add to this DrawingCanvasIContainer.add(graphics.IGraphic)public void remove(IGraphic g)
remove in interface IContainerg - The Graphic to removeIContainer.remove(graphics.IGraphic)public Collection<IGraphic> getAllGraphics()
public void removeAllGraphics()
public void paintComponent(Graphics gs)
paintComponent in class JComponentgs - The java.awt.Graphics object that will paint the GraphicsComponent.paint(java.awt.Graphics)public Point randomPoint()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||