nl.tudelft.simulation.dsol.gui.animation2D
Class GridPanel
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
nl.tudelft.simulation.dsol.gui.animation2D.GridPanel
- All Implemented Interfaces:
- ImageObserver, MenuContainer, Serializable, Accessible
- Direct Known Subclasses:
- AnimationPanel
public class GridPanel
- extends JPanel
The GridPanel introduces the gridPanel
(c) copyright 2002-2005 Delft
University of Technology , the Netherlands.
See for project information www.simulation.tudelft.nl
License of use: Lesser
General Public License (LGPL) , no warranty.
- Version:
- $Revision: 1.1 $ $Date: 2007/01/06 13:23:34 $
- Author:
- Niels Lang , Peter Jacobs
- See Also:
- Serialized Form
Field Summary |
static int |
DOWN
the DOWN directions for moving/zooming |
protected Rectangle2D |
extent
the extent of this panel |
protected NumberFormat |
formatter
the formatter to use |
protected static Color |
GRIDCOLOR
gridColor |
protected double |
gridSize
the gridSize in world Units |
protected Rectangle2D |
homeExtent
the extent of this panel |
static int |
IN
the ZOOM_IN directions for moving/zooming |
protected Dimension |
lastDimension
the last computed Dimension |
static int |
LEFT
the LEFT directions for moving/zooming |
static int |
OUT
the ZOOM_OUT directions for moving/zooming |
static int |
RIGHT
the RIGHT directions for moving/zooming |
protected boolean |
showGrid
show the grid |
static int |
UP
the UP directions for moving/zooming |
Method Summary |
protected void |
drawGrid(Graphics g)
Added to make sure the recursive render-call calls THIS render method
instead of a potential super-class defined 'paintComponent' render
method. |
Rectangle2D |
getExtent()
returns the extent of this panel |
void |
home()
resets the panel to its original extent |
boolean |
isShowGrid()
|
void |
paintComponent(Graphics g)
|
void |
pan(int direction,
double percentage)
pans the panel in a specified direction |
void |
setShowGrid(boolean showGrid)
|
void |
showGrid(boolean bool)
show the grid? |
void |
zoom(int direction,
double factor)
zooms in/out |
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, getBaseline, getBaselineResizeBehavior, 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, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, 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 |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, 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, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, 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, transferFocusBackward, transferFocusUpCycle |
UP
public static final int UP
- the UP directions for moving/zooming
- See Also:
- Constant Field Values
DOWN
public static final int DOWN
- the DOWN directions for moving/zooming
- See Also:
- Constant Field Values
LEFT
public static final int LEFT
- the LEFT directions for moving/zooming
- See Also:
- Constant Field Values
RIGHT
public static final int RIGHT
- the RIGHT directions for moving/zooming
- See Also:
- Constant Field Values
IN
public static final int IN
- the ZOOM_IN directions for moving/zooming
- See Also:
- Constant Field Values
OUT
public static final int OUT
- the ZOOM_OUT directions for moving/zooming
- See Also:
- Constant Field Values
GRIDCOLOR
protected static final Color GRIDCOLOR
- gridColor
extent
protected Rectangle2D extent
- the extent of this panel
homeExtent
protected Rectangle2D homeExtent
- the extent of this panel
showGrid
protected boolean showGrid
- show the grid
gridSize
protected double gridSize
- the gridSize in world Units
formatter
protected NumberFormat formatter
- the formatter to use
lastDimension
protected Dimension lastDimension
- the last computed Dimension
GridPanel
public GridPanel(Rectangle2D extent)
- constructs a new GridPanel
- Parameters:
extent
- the extent to show.
GridPanel
public GridPanel(Rectangle2D extent,
Dimension size)
- constructs a new GridPanel
- Parameters:
extent
- the initial extentsize
- the size of the panel in pixels.
getExtent
public Rectangle2D getExtent()
- returns the extent of this panel
- Returns:
- Rectangle2D
paintComponent
public void paintComponent(Graphics g)
- Overrides:
paintComponent
in class JComponent
- See Also:
#paintComponent(java.awt.Graphics)
showGrid
public void showGrid(boolean bool)
- show the grid?
- Parameters:
bool
- true/false
pan
public void pan(int direction,
double percentage)
- pans the panel in a specified direction
- Parameters:
direction
- the directionpercentage
- the percentage
home
public void home()
- resets the panel to its original extent
isShowGrid
public boolean isShowGrid()
- Returns:
- Returns the showGrid.
setShowGrid
public void setShowGrid(boolean showGrid)
- Parameters:
showGrid
- The showGrid to set.
zoom
public void zoom(int direction,
double factor)
- zooms in/out
- Parameters:
direction
- the zoom directionfactor
- The Factor
drawGrid
protected void drawGrid(Graphics g)
- Added to make sure the recursive render-call calls THIS render method
instead of a potential super-class defined 'paintComponent' render
method.
- Parameters:
g
- the graphics object
Copyright © 2002-2010 Delft University of Technology, the Netherlands. All Rights Reserved.