yops
Class BasicGraphicsPanel
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JLayeredPane
yops.BasicGraphicsPanel
- All Implemented Interfaces:
- MouseListener, MouseMotionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible
- Direct Known Subclasses:
- GraphicsPanel
public class BasicGraphicsPanel
- extends JLayeredPane
- implements MouseListener, MouseMotionListener
A GraphicsPanel is a container in which graphics components can be displayed.
- Author:
- Kenneth J. Goldman
Created Jul 5, 2005
- See Also:
- Serialized Form
Constructor Summary |
BasicGraphicsPanel(int width,
int height)
Creates a GraphicsPanel with the given dimensions. |
Method Summary |
Component |
add(Component c)
Adds the given component to the GraphicsPanel for display. |
void |
clear()
Removes all components from the GraphicsPanel, except for the background image. |
Image |
getMainImage()
Gets the background image of this graphics panel. |
void |
mouseClicked(MouseEvent me)
This method is called by the Java event loop when mouse events occur. |
void |
mouseDragged(int x,
int y)
This method will be called whenever the user moves the mouse within the panel
while holding down a mouse button. |
void |
mouseDragged(MouseEvent me)
This method is called by the Java event loop when mouse events occur. |
void |
mouseEntered(MouseEvent me)
This method is called by the Java event loop when mouse events occur. |
void |
mouseExited(MouseEvent me)
This method is called by the Java event loop when mouse events occur. |
void |
mouseMoved(int x,
int y)
This method will be called whenever the user moves the mouse within the panel. |
void |
mouseMoved(MouseEvent me)
This method is called by the Java event loop when mouse events occur. |
void |
mousePressed(int x,
int y)
This method will be called whenever the user pressses the mouse button on the panel. |
void |
mousePressed(MouseEvent me)
This method is called by the Java event loop when mouse events occur. |
void |
mouseReleased(int x,
int y)
This method will be called whenever the user releases the mouse button,
provided that the mouse button had been pressed within the panel. |
void |
mouseReleased(MouseEvent me)
This method is called by the Java event loop when mouse events occur. |
void |
moveToBack(Component arg0)
Places the given component behind all other components. |
void |
moveToFront(Component arg0)
Places the given component in front of all other components. |
void |
remove(Component c)
Removes the given component from the GraphicsPanel. |
Methods inherited from class javax.swing.JLayeredPane |
addImpl, getAccessibleContext, getComponentCountInLayer, getComponentsInLayer, getComponentToLayer, getIndexOf, getLayer, getLayer, getLayeredPaneAbove, getObjectForLayer, getPosition, highestLayer, insertIndexForLayer, isOptimizedDrawingEnabled, lowestLayer, paint, paramString, putLayer, remove, removeAll, setLayer, setLayer, setPosition |
Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI |
Methods inherited from class java.awt.Container |
add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
BasicGraphicsPanel
public BasicGraphicsPanel(int width,
int height)
- Creates a GraphicsPanel with the given dimensions.
- Parameters:
width
- in pixelsheight
- in pixels
add
public Component add(Component c)
- Adds the given component to the GraphicsPanel for display.
- Overrides:
add
in class Container
remove
public void remove(Component c)
- Removes the given component from the GraphicsPanel.
- Overrides:
remove
in class Container
clear
public void clear()
- Removes all components from the GraphicsPanel, except for the background image.
moveToBack
public void moveToBack(Component arg0)
- Places the given component behind all other components.
- Overrides:
moveToBack
in class JLayeredPane
moveToFront
public void moveToFront(Component arg0)
- Places the given component in front of all other components.
- Overrides:
moveToFront
in class JLayeredPane
getMainImage
public Image getMainImage()
- Gets the background image of this graphics panel.
- Returns:
- the background image
mousePressed
public void mousePressed(int x,
int y)
- This method will be called whenever the user pressses the mouse button on the panel.
- Parameters:
x
- in pixelsy
- in pixels
mouseReleased
public void mouseReleased(int x,
int y)
- This method will be called whenever the user releases the mouse button,
provided that the mouse button had been pressed within the panel.
- Parameters:
x
- in pixelsy
- in pixels
mouseMoved
public void mouseMoved(int x,
int y)
- This method will be called whenever the user moves the mouse within the panel.
- Parameters:
x
- in pixelsy
- in pixels
mouseDragged
public void mouseDragged(int x,
int y)
- This method will be called whenever the user moves the mouse within the panel
while holding down a mouse button.
- Parameters:
x
- in pixelsy
- in pixels
mouseClicked
public void mouseClicked(MouseEvent me)
- This method is called by the Java event loop when mouse events occur.
You should not call this method directly.
- Specified by:
mouseClicked
in interface MouseListener
mouseDragged
public void mouseDragged(MouseEvent me)
- This method is called by the Java event loop when mouse events occur.
You should not call this method directly.
- Specified by:
mouseDragged
in interface MouseMotionListener
mouseEntered
public void mouseEntered(MouseEvent me)
- This method is called by the Java event loop when mouse events occur.
You should not call this method directly.
- Specified by:
mouseEntered
in interface MouseListener
mouseExited
public void mouseExited(MouseEvent me)
- This method is called by the Java event loop when mouse events occur.
You should not call this method directly.
- Specified by:
mouseExited
in interface MouseListener
mouseMoved
public void mouseMoved(MouseEvent me)
- This method is called by the Java event loop when mouse events occur.
You should not call this method directly.
- Specified by:
mouseMoved
in interface MouseMotionListener
mousePressed
public void mousePressed(MouseEvent me)
- This method is called by the Java event loop when mouse events occur.
You should not call this method directly.
- Specified by:
mousePressed
in interface MouseListener
mouseReleased
public void mouseReleased(MouseEvent me)
- This method is called by the Java event loop when mouse events occur.
You should not call this method directly.
- Specified by:
mouseReleased
in interface MouseListener