Package PamView.menu

Class ModalPopupMenu

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants

public class ModalPopupMenu extends JDialog
A component that looks very much like a normal popup menu, but the show(...) function doesn't return until any menu actions are complete. This can be useful in popups where you need to act after one of the dialogs in the system has been opened and closed.
All the location setting code has been shamelessly copied from JPopupMenu
Author:
dg50
See Also:
  • Constructor Details Link icon

    • ModalPopupMenu Link icon

      public ModalPopupMenu()
      Create a modal popup menu. This behaves in almost exactly the same way as JPopupMenu, except that the show(...) function will not return until whatever actions are fired by the menu items have completed.
  • Method Details Link icon

    • add Link icon

      public Component add(Component menuItem)
      Overrides:
      add in class Container
    • show Link icon

      public AbstractButton show(Component invoker, int x, int y)
      Displays the popup menu at the position x,y in the coordinate space of the component invoker.
      Then blocks using a DOCUMENT_MODAL dialog until one of the menu items is selected AND the action called by the menu item has been completed. Would need to override to get an actual result from any action, but at least the caller knows something may have been done.
      Parameters:
      invoker -
      x -
      y -
      Returns:
      Reference to the menu item that we pressed, or null if the menu wasn't used
    • getInvoker Link icon

      public Component getInvoker()
      Returns:
      the invoker
    • setInvoker Link icon

      public void setInvoker(Component invoker)
      Parameters:
      invoker - the invoker to set
    • setLocation Link icon

      public void setLocation(int x, int y)
      Overrides:
      setLocation in class Window
    • processKeyEvent Link icon

      protected void processKeyEvent(KeyEvent e)
      Overrides:
      processKeyEvent in class Component