Class SystemMenuBar

java.lang.Object
qupath.lib.gui.prefs.SystemMenuBar

public class SystemMenuBar extends Object
Helper class for managing MenuBar.useSystemMenuBarProperty() values based upon a property value.

The original plan was to make it easier to control if all windows, the main window only, or no windows should use the system menubar.

Alas, that doesn't work well - at least on macOS. If a system menubar is set for the main window only, then its accelerators are still triggered even when another window with a non-system menubar is active.

For this reason, there is no option to use the system menubar for the main window only. This will be reinstated in the future, if a workaround can be found.

Since:
v0.5.0
  • Property Details

  • Constructor Details

    • SystemMenuBar

      public SystemMenuBar()
  • Method Details

    • systemMenubarProperty

      public static ObjectProperty<SystemMenuBar.SystemMenuBarOption> systemMenubarProperty()
      Property used to specify whether the system menubar should be used for the main QuPath stage. This should be bound bidirectionally to the corresponding property of any menubars created.
      Returns:
      Since:
      v0.5.0
    • manageMainMenuBar

      public static void manageMainMenuBar(MenuBar menuBar)
      Request that a menubar is managed as a main menubar. This means it is treated as a system menubar if #systemMenubarProperty() is set to ALL_WINDOWS or MAIN_WINDOW.
      Parameters:
      menuBar -
    • manageChildMenuBar

      public static void manageChildMenuBar(MenuBar menuBar)
      Request that a menubar is managed as a child menubar. This means it is treated as a system menubar if #systemMenubarProperty() is set to ALL_WINDOWS only.
      Parameters:
      menuBar -
    • unmanageMenuBar

      public static void unmanageMenuBar(MenuBar menuBar)
      Do not manage the system menubar status for the given menubar.
      Parameters:
      menuBar -
    • overrideSystemMenuBarProperty

      public static BooleanProperty overrideSystemMenuBarProperty()
      Property requesting that the system menubar should never be used for managed menubars. This is useful if another window requires access to the system menubar. In particular, it helps in a macOS application if a Java AWT window is being used (e.g. ImageJ), since the conflicting attempts to get the system menubar can cause confusing behavior.
      Returns:
      See Also:
    • getOverrideSystemMenuBar

      public static boolean getOverrideSystemMenuBar()
      Get the current value of the override property, which specifies whether the system menubar should not be used by any window - no matter what the value of systemMenubarProperty().
      Returns:
      See Also:
    • setOverrideSystemMenuBar

      public static void setOverrideSystemMenuBar(boolean doOverride)
      Set the current value of the override property, which optionally specifies whether the system menubar should not be used by any window - no matter what the value of systemMenubarProperty().
      Parameters:
      doOverride -
      See Also: