Class JidePopupMenu

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, MenuElement, Scrollable

public class JidePopupMenu extends JPopupMenu implements Scrollable
This component extends JPopupMenu and adds a method to display the menu inside the screen even if the mouse pointer is near the edge of the screen.

It also puts the menu items into a scroll pane. When there are too many menu items that can't fit into one screen, the scroll pane will scroll up and down so that you can still get to all menu items.

See Also:
  • Constructor Details

    • JidePopupMenu

      public JidePopupMenu()
      Constructs a JPopupMenu without an "invoker".
    • JidePopupMenu

      public JidePopupMenu(String label)
      Constructs a JPopupMenu with the specified title.
      Parameters:
      label - the string that a UI may use to display as a title for the popup menu.
  • Method Details

    • getUIClassID

      public String getUIClassID()
      Overrides:
      getUIClassID in class JPopupMenu
    • updateUI

      public void updateUI()
      Overrides:
      updateUI in class JPopupMenu
    • show

      public void show(Component invoker, int x, int y)
      Displays the PopUpMenu at a specified position.
      Overrides:
      show in class JPopupMenu
      Parameters:
      invoker - the component that triggers the event
      x - mouse X position on screen
      y - mouse Y position on screen
    • getPopupMenuOrigin

      protected Point getPopupMenuOrigin(Component invoker, int x, int y)
      Figures out the sizes needed to calculate the menu position.
      Parameters:
      invoker - the component that triggers the event
      x - mouse X position on screen
      y - mouse Y position on screen
      Returns:
      new position
    • setLocation

      public void setLocation(int x, int y)
      Overrides:
      setLocation in class JPopupMenu
    • getPreferredScrollableViewportSize

      public Dimension getPreferredScrollableViewportSize()
      Specified by:
      getPreferredScrollableViewportSize in interface Scrollable
    • getScrollableUnitIncrement

      public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction)
      Specified by:
      getScrollableUnitIncrement in interface Scrollable
    • getScrollableBlockIncrement

      public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction)
      Specified by:
      getScrollableBlockIncrement in interface Scrollable
    • getScrollableTracksViewportWidth

      public boolean getScrollableTracksViewportWidth()
      Specified by:
      getScrollableTracksViewportWidth in interface Scrollable
    • getScrollableTracksViewportHeight

      public boolean getScrollableTracksViewportHeight()
      Specified by:
      getScrollableTracksViewportHeight in interface Scrollable
    • getVisibleMenuItemCount

      public int getVisibleMenuItemCount()
      Gets the maximum visible menu item count.
      Returns:
      the maximum visible menu item count.
      Since:
      3.6.2
    • setVisibleMenuItemCount

      public void setVisibleMenuItemCount(int visibleMenuItemCount)
      Sets the visible menu item count. It will control the popup menu height along with the screen size, whichever is smaller.
      Parameters:
      visibleMenuItemCount - the maximum menu item count to be shown. -1 means no limit.
      Since:
      3.6.2