Package VASSAL.build.module.map
Class HidePiecesButton
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
VASSAL.build.module.map.HidePiecesButton
- All Implemented Interfaces:
MouseListener,ImageObserver,MenuContainer,Serializable,EventListener,Accessible,AutoConfigurable,Buildable,Configurable,GameComponent,Drawable,Translatable
public class HidePiecesButton extends JPanel implements MouseListener, AutoConfigurable, GameComponent, Drawable
This removes all game pieces from the (@link Map)
therefore providing an un-cluttered view.
- See Also:
- Serialized Form
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classHidePiecesButton.HiddenIconConfigstatic classHidePiecesButton.ShowingIconConfigNested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanelNested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategyNested classes/interfaces inherited from interface VASSAL.build.AutoConfigurable
AutoConfigurable.Util -
Field Summary
Fields Modifier and Type Field Description static StringBUTTON_TEXTstatic StringDEFAULT_HIDDEN_ICONstatic StringDEFAULT_SHOWING_ICONstatic StringHIDDEN_ICONprotected StringhiddenIconstatic StringHOTKEYprotected LaunchButtonlaunchstatic StringLAUNCH_ICONprotected Mapmapprotected ComponentI18nDatamyI18nDataprotected booleanpiecesVisiblestatic StringSHOWING_ICONprotected StringshowingIconstatic StringTOOLTIPFields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface VASSAL.build.Configurable
NAME_PROPERTYFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
Constructors Constructor Description HidePiecesButton() -
Method Summary
Modifier and Type Method Description voidadd(Buildable b)Adds a child component.voidaddPropertyChangeListener(PropertyChangeListener l)Add a PropertyChangeListener.voidaddTo(Buildable b)Expects to be added to aMap.voidbuild(Element e)Build the objectvoiddraw(Graphics g, Map m)booleandrawAboveCounters()Class<?>[]getAllowableConfigureComponents()Return a list of valid sub-component Classes.String[]getAttributeDescriptions()Return an array of Strings describing the attributes of this object.String[]getAttributeNames()Class<?>[]getAttributeTypes()Return the Class for the attributes of this object.StringgetAttributeValueString(String key)Called by theBuildable.getBuildElement(org.w3c.dom.Document)method to write the attributes into an XML elementVisibilityConditiongetAttributeVisibility(String name)Because attributes are not always applicable in all cases, this method returns an interface to determine when the controls for specifying the named attribute should be visible.ElementgetBuildElement(Document doc)Configurable[]getConfigureComponents()StringgetConfigureName()The name of this Configurable ObjectConfigurergetConfigurer()Return aConfigurerobject which can be used to set the attributes of this objectstatic StringgetConfigureTypeName()HelpFilegetHelpFile()ComponentI18nDatagetI18nData()CommandgetRestoreCommand()When saving a game, each GameComponent should return aCommandthat, when executed, restores the GameComponent to its state when the game was saved If this component has no persistent state, return nullStringgetToolTipText(MouseEvent e)voidmouseClicked(MouseEvent e)voidmouseEntered(MouseEvent e)voidmouseExited(MouseEvent e)voidmousePressed(MouseEvent e)voidmouseReleased(MouseEvent e)voidpaint(Graphics g)voidremove(Buildable b)Remove a child componentvoidremoveFrom(Buildable b)Remove this component from its parentvoidsetAttribute(String key, Object value)Called by theBuildable.build(org.w3c.dom.Element)method, wherevalueis the String value read by the XML attribute.protected voidsetPiecesVisible(boolean visible)voidsetup(boolean show)Notify the GameComponent that a game has started/endedMethods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIMethods 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, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, 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, updateMethods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, 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, validateTreeMethods 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
piecesVisible
protected boolean piecesVisible -
map
-
launch
-
showingIcon
-
myI18nData
-
DEFAULT_SHOWING_ICON
- See Also:
- Constant Field Values
-
DEFAULT_HIDDEN_ICON
- See Also:
- Constant Field Values
-
HOTKEY
- See Also:
- Constant Field Values
-
HIDDEN_ICON
- See Also:
- Constant Field Values
-
SHOWING_ICON
- See Also:
- Constant Field Values
-
LAUNCH_ICON
- See Also:
- Constant Field Values
-
TOOLTIP
- See Also:
- Constant Field Values
-
BUTTON_TEXT
- See Also:
- Constant Field Values
-
-
Constructor Details
-
HidePiecesButton
public HidePiecesButton()
-
-
Method Details
-
addTo
-
setPiecesVisible
protected void setPiecesVisible(boolean visible) -
add
Description copied from interface:BuildableAdds a child component. Both this method andBuildable.addTo(VASSAL.build.Buildable)are invoked when adding a child to a parent -
remove
Description copied from interface:ConfigurableRemove a child component- Specified by:
removein interfaceConfigurable
-
removeFrom
Description copied from interface:ConfigurableRemove this component from its parent- Specified by:
removeFromin interfaceConfigurable
-
setAttribute
Description copied from interface:AutoConfigurableCalled by theBuildable.build(org.w3c.dom.Element)method, wherevalueis the String value read by the XML attribute. Can also be called with Object value to set the attribute.- Specified by:
setAttributein interfaceAutoConfigurable- Specified by:
setAttributein interfaceTranslatable- Parameters:
key- the name of the attribute. If the implementing class extendsAbstractConfigurable, will be one of those listed inAbstractBuildable.getAttributeNames().value- If thevalueparameter is a String, it will be the value returned byTranslatable.getAttributeValueString(java.lang.String)for the samekey. If the implementing class extendsAbstractConfigurable, thenvaluecan also be an instance of the corresponding Class listed inAbstractConfigurable.getAttributeTypes()
-
build
Description copied from interface:BuildableBuild the object -
getAttributeNames
- Specified by:
getAttributeNamesin interfaceAutoConfigurable- Returns:
- an array of Strings giving all attributes of this Buildable component that will be written to/read from an XML element
-
getAttributeVisibility
Description copied from interface:AutoConfigurableBecause attributes are not always applicable in all cases, this method returns an interface to determine when the controls for specifying the named attribute should be visible.- Specified by:
getAttributeVisibilityin interfaceAutoConfigurable- Returns:
- null if the attribute controls should always be visible;
-
getAttributeValueString
Description copied from interface:AutoConfigurableCalled by theBuildable.getBuildElement(org.w3c.dom.Document)method to write the attributes into an XML element- Specified by:
getAttributeValueStringin interfaceAutoConfigurable- Specified by:
getAttributeValueStringin interfaceTranslatable- Parameters:
key- the name of the attribute. If the implementing class extendsAbstractConfigurable, will be one of those listed inAbstractBuildable.getAttributeNames().- Returns:
- a String representation of the attribute with the given name. When initializing a module, this String value will be passed to
Translatable.setAttribute(java.lang.String, java.lang.Object).
-
getAttributeDescriptions
Description copied from interface:AutoConfigurableReturn an array of Strings describing the attributes of this object. These strings are used as prompts in the Properties window for this object.- Specified by:
getAttributeDescriptionsin interfaceAutoConfigurable
-
getAttributeTypes
Description copied from interface:AutoConfigurableReturn the Class for the attributes of this object. Valid classes are: String, Integer, Double, Boolean, Image, File, Color, and KeyStroke- Specified by:
getAttributeTypesin interfaceAutoConfigurable
-
draw
-
drawAboveCounters
public boolean drawAboveCounters()- Specified by:
drawAboveCountersin interfaceDrawable
-
paint
- Overrides:
paintin classJComponent
-
mousePressed
- Specified by:
mousePressedin interfaceMouseListener
-
mouseEntered
- Specified by:
mouseEnteredin interfaceMouseListener
-
mouseExited
- Specified by:
mouseExitedin interfaceMouseListener
-
mouseClicked
- Specified by:
mouseClickedin interfaceMouseListener
-
mouseReleased
- Specified by:
mouseReleasedin interfaceMouseListener
-
getToolTipText
- Overrides:
getToolTipTextin classJComponent
-
getRestoreCommand
Description copied from interface:GameComponentWhen saving a game, each GameComponent should return aCommandthat, when executed, restores the GameComponent to its state when the game was saved If this component has no persistent state, return null- Specified by:
getRestoreCommandin interfaceGameComponent
-
setup
public void setup(boolean show)Description copied from interface:GameComponentNotify the GameComponent that a game has started/ended- Specified by:
setupin interfaceGameComponent- Parameters:
show- if true, a game is starting. If false, then a game is ending
-
getConfigureTypeName
-
getConfigureName
Description copied from interface:ConfigurableThe name of this Configurable Object- Specified by:
getConfigureNamein interfaceConfigurable
-
getConfigurer
Description copied from interface:ConfigurableReturn aConfigurerobject which can be used to set the attributes of this object- Specified by:
getConfigurerin interfaceConfigurable
-
getConfigureComponents
- Specified by:
getConfigureComponentsin interfaceConfigurable- Returns:
- an array of Configurer objects representing the Configurable children of this Configurable object
-
getAllowableConfigureComponents
Description copied from interface:ConfigurableReturn a list of valid sub-component Classes. If a Class appears in this list, then instances of that class may be added to this component from the Configuration Window.- Specified by:
getAllowableConfigureComponentsin interfaceConfigurable
-
addPropertyChangeListener
Description copied from interface:ConfigurableAdd a PropertyChangeListener. A PropertyChangeEvent should be fired with property nameConfigurable.NAME_PROPERTYwhen the value returned fromConfigurable.getConfigureName()has changed- Specified by:
addPropertyChangeListenerin interfaceConfigurable- Overrides:
addPropertyChangeListenerin classContainer
-
getHelpFile
- Specified by:
getHelpFilein interfaceConfigurable- Returns:
- a HelpFilte describing how to use and configure this component
-
getBuildElement
- Specified by:
getBuildElementin interfaceBuildable- Returns:
- an XML element from which this component can be built
-
getI18nData
- Specified by:
getI18nDatain interfaceTranslatable
-