|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--javax.swing.JPanel | +--NGP.Containers.Panel | +--NGP.Containers.DrawingPanel
A Panel that allows Graphics to be drawn. NGP automatically draws objects by putting them in this special Container. The DrawingPanel keeps track of the Graphics and tells them to draw when it is appropriate. It has some special methods, some of which will be necessary for the normal user, some which aren't.
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 NGP.Colorable |
DEFAULT_GRAY |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
DrawingPanel(Container container)
Create a DrawingPanel with the container as its parent. |
Method Summary | |
void |
addGraphic(Graphic g)
Normal users need not use this! |
boolean |
lowerGraphic(Graphic g)
Lower the graphic to be behind one more grpahic on the screen. |
void |
paintComponent(Graphics g)
Normal users need not use this! |
void |
paintGraphics(Graphics g)
Normal users need not use this! |
boolean |
raiseGraphic(Graphic g)
Raise the graphic to be in front of one more graphic on the screen. |
Point |
randomPoint()
Give a random point in this DrawingPanel. |
void |
removeAllGraphics()
Normal users need not use this! |
void |
removeGraphic(Graphic g)
Normal users need not use this! |
void |
saveAsJPEG(File file)
Save the DrawingPanel as a JPEG to the file that was passed in. |
Methods inherited from class NGP.Containers.Panel |
getColor, getDimension, isFocusTraversable, setColor, setDimension |
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 NGP.Container |
add, remove |
Constructor Detail |
public DrawingPanel(Container container)
container
- the graphical container for this PanelMethod Detail |
public void addGraphic(Graphic g)
Add the Graphic to the vector and add the mouse listener so that it will be able to react.
g
- the Graphic to addpublic void removeGraphic(Graphic g)
Remove the Graphic from the vector and remove the mouse listener so that it won't be able to react.
g
- the Graphic to removepublic void removeAllGraphics()
Remove all of the graphics from the vector and remove their mouse listeners so that they won't be able to react.
public boolean raiseGraphic(Graphic g)
g
- the Graphic that should be raised.
public boolean lowerGraphic(Graphic g)
g
- the Graphic that should be lowered.
public void paintGraphics(Graphics g)
Loop through all of the NGP.Graphics and paint each one. If we are only updating part of the screen, the Graphics instance will be set correctly so we don't have to worry about it.
g
- the Graphics that we usepublic void paintComponent(Graphics g)
Called by AWT to paint the panel. Ours just paints all the contained Graphics.
paintComponent
in class JComponent
g
- the Graphics
we should usepublic Point randomPoint()
Point
public void saveAsJPEG(File file)
file
- the java.io.File that this image should be saved to
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |