Class JaxoFBoxPopupMenu

All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, MenuElement, JaxoLocalized

public class JaxoFBoxPopupMenu extends JPopupMenu implements ActionListener, JaxoLocalized
Displays a pop-up menu relating the currently marked objects (in JaxoCanvas, if the user right-clicks on the canvas, drag the mouse to enclose some objects and release the mouse).
Since:
2.0
See Also:
  • Field Details

    • PASTE

      public static final int PASTE
      The menu item for paste.
      Since:
      2.1
      See Also:
    • UNGROUP

      public static final int UNGROUP
      The menu item for ungroup.
      Since:
      2.1
      See Also:
    • GROUP

      public static final int GROUP
      The menu item for group.
      Since:
      2.1
      See Also:
  • Constructor Details

    • JaxoFBoxPopupMenu

      public JaxoFBoxPopupMenu()
      Constructor.
      Since:
      2.1
    • JaxoFBoxPopupMenu

      public JaxoFBoxPopupMenu(ActionListener listener)
      Constructor: sets all the menu entries and adds one action listener.
      Parameters:
      listener - an ActionListener to receive events from this PopupMenu. May be null.
  • Method Details

    • addActionListener

      public void addActionListener(ActionListener l)
      Action events will be fire when the menu is "closed" - either because an item was chosen or because it was cancelled.
      Parameters:
      l - The ActionListener to add.
    • removeActionListener

      public void removeActionListener(ActionListener l)
      Removes the action listener.
      Parameters:
      l - The ActionListener to remove.
    • fireActionPerformed

      protected void fireActionPerformed(String actionCommand)
      Notifies all components of an action event.
      Parameters:
      actionCommand - The action command of the action to be fire.
    • fireActionPerformed

      protected void fireActionPerformed(String actionCommand, ActionEvent e)
      Notifies all components of an action event.
      Parameters:
      actionCommand - The action command of the action to be fire.
      e - the ActionEvent to be fired. May be null.
      Since:
      2.1
    • setMenuItemEnabled

      public final void setMenuItemEnabled(int mitem, boolean value)
      Enabled/Disables the given menu item. Currently only works for mitem = PASTE, = GROUP, = GROUP.
      Parameters:
      mitem - Integer specifying the menu item.
      value - True for enable, false for disable.
    • onlyPastePopup

      public final void onlyPastePopup()
      Prepare for a popup only showing "Paste".
    • normalPopup

      public final void normalPopup()
      Prepare for a normal popup.
    • actionPerformed

      public void actionPerformed(ActionEvent e)
      forward to main panel, then fire actionPerformed.
      Specified by:
      actionPerformed in interface ActionListener
      Parameters:
      e - The ActionEvent.
    • firePopupMenuCanceled

      protected void firePopupMenuCanceled()
      , then fire actionPerformed.
      Overrides:
      firePopupMenuCanceled in class JPopupMenu
    • show

      public void show(Component invoker, int x, int y)
      Displays the popup menu.
      Overrides:
      show in class JPopupMenu
      Parameters:
      invoker - the component in whose space the popup is to appear.
      x - the x-coordinate of the popup.
      y - the y-coordinate of the popup.
    • updateLanguage

      public final void updateLanguage()
      Updates the component with the current language as set in the preferences (JaxoPrefs.PREF_LANGUAGE).
      Specified by:
      updateLanguage in interface JaxoLocalized