Class JMenuItemLocation

java.lang.Object
org.fest.swing.driver.JMenuItemLocation

public final class JMenuItemLocation extends Object
Understands the location of a JMenuItem.
  • Field Details

    • parentOrInvoker

      private Component parentOrInvoker
    • parentPopup

      private JPopupMenu parentPopup
    • inMenuBar

      private final boolean inMenuBar
  • Constructor Details

    • JMenuItemLocation

      @RunsInCurrentThread public JMenuItemLocation(JMenuItem menuItem)
      Creates a new JMenuItemLocation.

      Note: This constructor is not executed in the event dispatch thread (EDT.) Clients are responsible for invoking this constructor in the EDT.

      Parameters:
      menuItem - the target JMenuItem.
  • Method Details

    • inMenuBar

      public boolean inMenuBar()
      Indicates whether the JMenuItem is in a JMenuBar.
      Returns:
      true if the JMenuItem is in a JMenuBar, false otherwise.
    • isParentAMenu

      @RunsInEDT public boolean isParentAMenu()
      Indicates whether the parent of the JMenuItem is another menu.
      Returns:
      true if the parent of the JMenuItem is another menu, false otherwise.
    • parentOrInvoker

      public Component parentOrInvoker()
      Returns the parent of JMenuItem, or its invoker (if it is in a pop-up.)
      Returns:
      the parent or the invoker of the JMenuItem.
    • parentPopup

      public JPopupMenu parentPopup()
      Returns the parent pop-up menu, or null if the JMenuItem is not in a pop-up.
      Returns:
      the parent pop-up menu, or null if the JMenuItem is not in a pop-up.