Package VASSAL.build.module.map
Class MenuDisplayer
java.lang.Object
java.awt.event.MouseAdapter
VASSAL.build.module.map.MenuDisplayer
- All Implemented Interfaces:
MouseListener,MouseMotionListener,MouseWheelListener,EventListener,Buildable
public class MenuDisplayer extends MouseAdapter implements Buildable
-
Field Summary
Fields Modifier and Type Field Description protected Mapmapstatic FontPOPUP_MENU_FONTprotected PieceFindertargetSelector -
Constructor Summary
Constructors Constructor Description MenuDisplayer() -
Method Summary
Modifier and Type Method Description voidadd(Buildable b)Adds a child component.voidaddTo(Buildable b)Adds this component to its parent.voidbuild(Element e)Build the objectstatic JPopupMenucreatePopup(GamePiece target)static JPopupMenucreatePopup(GamePiece target, boolean global)protected PieceFindercreateTargetSelector()Return aPieceFinderinstance that will select aGamePiecewhose menu will be displayed when the user clicks on the mapElementgetBuildElement(Document doc)protected static StringgetMenuText(KeyCommand keyCommand)protected static JMenuItemmakeMenuItem(KeyCommand keyCommand)protected voidmaybePopup(MouseEvent e)voidmousePressed(MouseEvent e)voidmouseReleased(MouseEvent e)Methods inherited from class java.awt.event.MouseAdapter
mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mouseWheelMoved
-
Field Details
-
POPUP_MENU_FONT
-
map
-
targetSelector
-
-
Constructor Details
-
MenuDisplayer
public MenuDisplayer()
-
-
Method Details
-
addTo
Description copied from interface:BuildableAdds this component to its parent. In order to make Buildable objects extensible, the child is reponsible for adding itself to the parent. That way, Buildable subcomponents can be defined in an extension package without needing to modify the containing class. -
createTargetSelector
Return aPieceFinderinstance that will select aGamePiecewhose menu will be displayed when the user clicks on the map- Returns:
-
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 -
getBuildElement
- Specified by:
getBuildElementin interfaceBuildable- Returns:
- an XML element from which this component can be built
-
build
Description copied from interface:BuildableBuild the object -
getMenuText
-
makeMenuItem
-
createPopup
-
createPopup
- Parameters:
target-global- If true, then apply the KeyCommands globally, i.e. to all selected pieces- Returns:
-
mousePressed
- Specified by:
mousePressedin interfaceMouseListener- Overrides:
mousePressedin classMouseAdapter
-
mouseReleased
- Specified by:
mouseReleasedin interfaceMouseListener- Overrides:
mouseReleasedin classMouseAdapter
-
maybePopup
-