public class PlayField
extends javax.swing.JPanel
javax.swing.JPanel.AccessibleJPaneljavax.swing.JComponent.AccessibleJComponent| Modifier and Type | Field and Description |
|---|---|
static int |
PLAYFIELD_OFFSET |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW| Constructor and Description |
|---|
PlayField(World w,
DTNSimGUI gui)
Creates a playfield
|
| Modifier and Type | Method and Description |
|---|---|
void |
addMessageTransfer(DTNHost from,
DTNHost to)
Adds graphics for message transfer
|
void |
addPath(Path path)
Adds a path to the overlay graphics
|
void |
clearOverlays()
Removes all overlay graphics stored to be drawn
|
Coord |
getGraphicsPosition(Coord loc)
Returns the graphical presentation location for the given world
location
|
Coord |
getWorldPosition(Coord loc)
Returns a world location for a given graphical location.
|
void |
paint(java.awt.Graphics g)
Draws the play field.
|
void |
setAutoClearOverlay(boolean clear)
Enables or disables the automatic clearing of overlay graphics.
|
void |
setFocusOnClick(boolean focus)
Enables or disables the automatic clearing of overlay graphics.
|
void |
setMap(SimMap simMap)
Sets the source for the map graphics and enables map graphics showing
|
void |
setScale(double scale)
Sets the zooming/scaling factor
|
void |
setShowMapGraphic(boolean show)
Enables/disables showing of map graphics
|
void |
setUnderlayImage(java.awt.image.BufferedImage image,
double dx,
double dy,
double scale,
double rotation)
Sets an image to show under the host graphics
|
void |
updateField()
Schedule the play field to be drawn
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIaddAncestorListener, 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, isPaintingOrigin, 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, updateadd, 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, validateTreeaction, 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, transferFocusUpCyclepublic static final int PLAYFIELD_OFFSET
public void updateField()
public void setUnderlayImage(java.awt.image.BufferedImage image,
double dx,
double dy,
double scale,
double rotation)
image - The image to set or null to remove the imagedx - X offset of the imagedy - Y offset of the imagescale - Image scaling factorrotation - Rotatation angle of the image (radians)public void setScale(double scale)
scale - The new scalepublic void setMap(SimMap simMap)
simMap - The map to showpublic void setShowMapGraphic(boolean show)
show - True if the map graphics should be shown (false if not)public void setAutoClearOverlay(boolean clear)
clear - Auto clear is enabled if this is true, disabled on falsepublic void setFocusOnClick(boolean focus)
clear - Auto clear is enabled if this is true, disabled on falsepublic void paint(java.awt.Graphics g)
paint in class javax.swing.JComponentg - The graphics context to draw the field topublic void clearOverlays()
public void addMessageTransfer(DTNHost from, DTNHost to)
from - Who the message was fromto - Who the message was topublic void addPath(Path path)
path - Path to addpublic Coord getGraphicsPosition(Coord loc)
loc - The location to convertgetWorldPosition(Coord)public Coord getWorldPosition(Coord loc)
loc - The location to convertgetGraphicsPosition(Coord)