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 Details

    • map

      protected Map map
    • targetSelector

      protected PieceFinder targetSelector
  • Constructor Details

    • MenuDisplayer

      public MenuDisplayer()
  • Method Details

    • addTo

      public void addTo(Buildable b)
      Description copied from interface: Buildable
      Adds this component to its parent. In order to make Buildable objects extensible, the child is responsible for adding itself to the parent. That way, Buildable subcomponents can be defined in an extension package without needing to modify the containing class.
      Specified by:
      addTo in interface Buildable
      Parameters:
      b - parent Buildable to add this component to as a subcomponent.
    • createTargetSelector

      protected PieceFinder createTargetSelector()
      Return a PieceFinder instance that will select a GamePiece whose menu will be displayed when the user clicks on the map
      Returns:
    • add

      public void add(Buildable b)
      Description copied from interface: Buildable
      Adds a child component. Both this method and Buildable.addTo(VASSAL.build.Buildable) are invoked when adding a child to a parent
      Specified by:
      add in interface Buildable
      Parameters:
      b - Child to attach to this buildable as a subcomponent
    • getBuildElement

      public Element getBuildElement(Document doc)
      Specified by:
      getBuildElement in interface Buildable
      Parameters:
      doc - XML file
      Returns:
      an XML element from which this component can be built
    • build

      public void build(Element e)
      Description copied from interface: Buildable
      Build the object from the XML representation of the Buildable
      Specified by:
      build in interface Buildable
      Parameters:
      e - the XML element containing the object data
    • getMenuText

      protected static String getMenuText(KeyCommand keyCommand)
    • makeMenuItem

      protected static JMenuItem makeMenuItem(KeyCommand keyCommand)
    • createPopup

      public static JPopupMenu createPopup(GamePiece target)
    • createPopup

      public static JPopupMenu createPopup(GamePiece target, boolean global)
      Parameters:
      target -
      global - If true, then apply the KeyCommands globally, i.e. to all selected pieces
      Returns:
    • mousePressed

      public void mousePressed(MouseEvent e)
      Specified by:
      mousePressed in interface MouseListener
      Overrides:
      mousePressed in class MouseAdapter
    • mouseReleased

      public void mouseReleased(MouseEvent e)
      Specified by:
      mouseReleased in interface MouseListener
      Overrides:
      mouseReleased in class MouseAdapter
    • maybePopup

      protected void maybePopup(MouseEvent e)