|
||||||||||
| 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
cse115.graphics.DrawingCanvas
public class DrawingCanvas
This is a JPanel that acts as a container for Graphics. Place graphics onto this.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JPanel |
|---|
JPanel.AccessibleJPanel |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary |
|---|
| Fields inherited from class javax.swing.JComponent |
|---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, 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(Graphic g)
Adds a Graphic onto the DrawingCanvas. |
Collection<Graphic> |
getAllGraphics()
Gets a Collection of all the Graphics on this DrawingCanvas |
Point |
getCenterLocation()
Gets the center of the DrawingCanvas |
Color |
getColor()
Gets the Color of this DrawingCanvas |
Dimension |
getDimension()
Gets the Dimension of this 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 |
paint(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(Graphic g)
Removes a Graphic from the DrawingCanvas. |
void |
removeAllGraphics()
|
void |
setColor(Color color)
Sets the Color of this DrawingCanvas |
void |
setDimension(Dimension dimension)
Sets the Dimension of this DrawingCanvas |
void |
setLocation(Point p)
Sets the Location of this DrawingCanvas to a specified point. |
| Methods inherited from class javax.swing.JPanel |
|---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface cse115.graphics.IContainer |
|---|
repaint, repaint |
| Methods inherited from interface java.awt.image.ImageObserver |
|---|
imageUpdate |
| 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 setDimension(Dimension dimension)
setDimension in interface Sizeabledimension - public Dimension getDimension()
getDimension in interface IContainergetDimension in interface Sizeablepublic 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 setColor(Color color)
color - public Color getColor()
public void add(Graphic g)
add in interface IContainerg - The Graphic to add to this DrawingCanvasIContainer.add(cse115.graphics.Graphic)public void remove(Graphic g)
remove in interface IContainerg - The Graphic to removeIContainer.remove(cse115.graphics.Graphic)public Collection<Graphic> getAllGraphics()
public void removeAllGraphics()
public void paint(Graphics gs)
paint 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 | |||||||||