com.apple.laf.AquaMenuBarUI Java Examples
The following examples show how to use
com.apple.laf.AquaMenuBarUI.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: _AppMenuBarHandler.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("deprecation") static void installDefaultMenuBar(final JMenuBar menuBar) { if (menuBar == null) { // intentionally clearing the default menu nativeSetDefaultMenuBar(0); return; } final MenuBarUI ui = menuBar.getUI(); if (!(ui instanceof AquaMenuBarUI)) { // Aqua was not installed throw new IllegalStateException("Application.setDefaultMenuBar() only works with the Aqua Look and Feel"); } final AquaMenuBarUI aquaUI = (AquaMenuBarUI)ui; final ScreenMenuBar screenMenuBar = aquaUI.getScreenMenuBar(); if (screenMenuBar == null) { // Aqua is installed, but we aren't using the screen menu bar throw new IllegalStateException("Application.setDefaultMenuBar() only works if apple.laf.useScreenMenuBar=true"); } screenMenuBar.addNotify(); final MenuComponentPeer peer = screenMenuBar.getPeer(); if (!(peer instanceof CMenuBar)) { // such a thing should not be possible throw new IllegalStateException("Unable to determine native menu bar from provided JMenuBar"); } // grab the pointer to the CMenuBar, and retain it in native ((CMenuBar) peer).execute(_AppMenuBarHandler::nativeSetDefaultMenuBar); }
Example #2
Source File: _AppMenuBarHandler.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("deprecation") static void installDefaultMenuBar(final JMenuBar menuBar) { if (menuBar == null) { // intentionally clearing the default menu nativeSetDefaultMenuBar(0); return; } final MenuBarUI ui = menuBar.getUI(); if (!(ui instanceof AquaMenuBarUI)) { // Aqua was not installed throw new IllegalStateException("Application.setDefaultMenuBar() only works with the Aqua Look and Feel"); } final AquaMenuBarUI aquaUI = (AquaMenuBarUI)ui; final ScreenMenuBar screenMenuBar = aquaUI.getScreenMenuBar(); if (screenMenuBar == null) { // Aqua is installed, but we aren't using the screen menu bar throw new IllegalStateException("Application.setDefaultMenuBar() only works if apple.laf.useScreenMenuBar=true"); } screenMenuBar.addNotify(); final MenuComponentPeer peer = screenMenuBar.getPeer(); if (!(peer instanceof CMenuBar)) { // such a thing should not be possible throw new IllegalStateException("Unable to determine native menu bar from provided JMenuBar"); } // grab the pointer to the CMenuBar, and retain it in native ((CMenuBar) peer).execute(_AppMenuBarHandler::nativeSetDefaultMenuBar); }
Example #3
Source File: _AppMenuBarHandler.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("deprecation") static void installDefaultMenuBar(final JMenuBar menuBar) { if (menuBar == null) { // intentionally clearing the default menu nativeSetDefaultMenuBar(0); return; } final MenuBarUI ui = menuBar.getUI(); if (!(ui instanceof AquaMenuBarUI)) { // Aqua was not installed throw new IllegalStateException("Application.setDefaultMenuBar() only works with the Aqua Look and Feel"); } final AquaMenuBarUI aquaUI = (AquaMenuBarUI)ui; final ScreenMenuBar screenMenuBar = aquaUI.getScreenMenuBar(); if (screenMenuBar == null) { // Aqua is installed, but we aren't using the screen menu bar throw new IllegalStateException("Application.setDefaultMenuBar() only works if apple.laf.useScreenMenuBar=true"); } screenMenuBar.addNotify(); final MenuComponentPeer peer = screenMenuBar.getPeer(); if (!(peer instanceof CMenuBar)) { // such a thing should not be possible throw new IllegalStateException("Unable to determine native menu bar from provided JMenuBar"); } // grab the pointer to the CMenuBar, and retain it in native nativeSetDefaultMenuBar(((CMenuBar)peer).getModel()); }
Example #4
Source File: _AppMenuBarHandler.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("deprecation") static void installDefaultMenuBar(final JMenuBar menuBar) { if (menuBar == null) { // intentionally clearing the default menu nativeSetDefaultMenuBar(0); return; } final MenuBarUI ui = menuBar.getUI(); if (!(ui instanceof AquaMenuBarUI)) { // Aqua was not installed throw new IllegalStateException("Application.setDefaultMenuBar() only works with the Aqua Look and Feel"); } final AquaMenuBarUI aquaUI = (AquaMenuBarUI)ui; final ScreenMenuBar screenMenuBar = aquaUI.getScreenMenuBar(); if (screenMenuBar == null) { // Aqua is installed, but we aren't using the screen menu bar throw new IllegalStateException("Application.setDefaultMenuBar() only works if apple.laf.useScreenMenuBar=true"); } screenMenuBar.addNotify(); final MenuComponentPeer peer = screenMenuBar.getPeer(); if (!(peer instanceof CMenuBar)) { // such a thing should not be possible throw new IllegalStateException("Unable to determine native menu bar from provided JMenuBar"); } // grab the pointer to the CMenuBar, and retain it in native ((CMenuBar) peer).execute(_AppMenuBarHandler::nativeSetDefaultMenuBar); }
Example #5
Source File: _AppMenuBarHandler.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("deprecation") static void installDefaultMenuBar(final JMenuBar menuBar) { if (menuBar == null) { // intentionally clearing the default menu nativeSetDefaultMenuBar(0); return; } final MenuBarUI ui = menuBar.getUI(); if (!(ui instanceof AquaMenuBarUI)) { // Aqua was not installed throw new IllegalStateException("Application.setDefaultMenuBar() only works with the Aqua Look and Feel"); } final AquaMenuBarUI aquaUI = (AquaMenuBarUI)ui; final ScreenMenuBar screenMenuBar = aquaUI.getScreenMenuBar(); if (screenMenuBar == null) { // Aqua is installed, but we aren't using the screen menu bar throw new IllegalStateException("Application.setDefaultMenuBar() only works if apple.laf.useScreenMenuBar=true"); } screenMenuBar.addNotify(); final MenuComponentPeer peer = screenMenuBar.getPeer(); if (!(peer instanceof CMenuBar)) { // such a thing should not be possible throw new IllegalStateException("Unable to determine native menu bar from provided JMenuBar"); } // grab the pointer to the CMenuBar, and retain it in native ((CMenuBar) peer).execute(_AppMenuBarHandler::nativeSetDefaultMenuBar); }
Example #6
Source File: LWCToolkit.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public void updateScreenMenuBarUI() { if (AquaMenuBarUI.getScreenMenuBarProperty()) { UIManager.put("MenuBarUI", "com.apple.laf.AquaMenuBarUI"); } else { UIManager.put("MenuBarUI", null); } }
Example #7
Source File: _AppMenuBarHandler.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("deprecation") static void installDefaultMenuBar(final JMenuBar menuBar) { if (menuBar == null) { // intentionally clearing the default menu nativeSetDefaultMenuBar(0); return; } final MenuBarUI ui = menuBar.getUI(); if (!(ui instanceof AquaMenuBarUI)) { // Aqua was not installed throw new IllegalStateException("Application.setDefaultMenuBar() only works with the Aqua Look and Feel"); } final AquaMenuBarUI aquaUI = (AquaMenuBarUI)ui; final ScreenMenuBar screenMenuBar = aquaUI.getScreenMenuBar(); if (screenMenuBar == null) { // Aqua is installed, but we aren't using the screen menu bar throw new IllegalStateException("Application.setDefaultMenuBar() only works if apple.laf.useScreenMenuBar=true"); } screenMenuBar.addNotify(); final MenuComponentPeer peer = screenMenuBar.getPeer(); if (!(peer instanceof CMenuBar)) { // such a thing should not be possible throw new IllegalStateException("Unable to determine native menu bar from provided JMenuBar"); } // grab the pointer to the CMenuBar, and retain it in native ((CMenuBar) peer).execute(_AppMenuBarHandler::nativeSetDefaultMenuBar); }
Example #8
Source File: _AppMenuBarHandler.java From hottub with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("deprecation") static void installDefaultMenuBar(final JMenuBar menuBar) { if (menuBar == null) { // intentionally clearing the default menu nativeSetDefaultMenuBar(0); return; } final MenuBarUI ui = menuBar.getUI(); if (!(ui instanceof AquaMenuBarUI)) { // Aqua was not installed throw new IllegalStateException("Application.setDefaultMenuBar() only works with the Aqua Look and Feel"); } final AquaMenuBarUI aquaUI = (AquaMenuBarUI)ui; final ScreenMenuBar screenMenuBar = aquaUI.getScreenMenuBar(); if (screenMenuBar == null) { // Aqua is installed, but we aren't using the screen menu bar throw new IllegalStateException("Application.setDefaultMenuBar() only works if apple.laf.useScreenMenuBar=true"); } screenMenuBar.addNotify(); final MenuComponentPeer peer = screenMenuBar.getPeer(); if (!(peer instanceof CMenuBar)) { // such a thing should not be possible throw new IllegalStateException("Unable to determine native menu bar from provided JMenuBar"); } // grab the pointer to the CMenuBar, and retain it in native nativeSetDefaultMenuBar(((CMenuBar)peer).getModel()); }
Example #9
Source File: _AppMenuBarHandler.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("deprecation") static void installDefaultMenuBar(final JMenuBar menuBar) { if (menuBar == null) { // intentionally clearing the default menu nativeSetDefaultMenuBar(0); return; } final MenuBarUI ui = menuBar.getUI(); if (!(ui instanceof AquaMenuBarUI)) { // Aqua was not installed throw new IllegalStateException("Application.setDefaultMenuBar() only works with the Aqua Look and Feel"); } final AquaMenuBarUI aquaUI = (AquaMenuBarUI)ui; final ScreenMenuBar screenMenuBar = aquaUI.getScreenMenuBar(); if (screenMenuBar == null) { // Aqua is installed, but we aren't using the screen menu bar throw new IllegalStateException("Application.setDefaultMenuBar() only works if apple.laf.useScreenMenuBar=true"); } screenMenuBar.addNotify(); final MenuComponentPeer peer = screenMenuBar.getPeer(); if (!(peer instanceof CMenuBar)) { // such a thing should not be possible throw new IllegalStateException("Unable to determine native menu bar from provided JMenuBar"); } // grab the pointer to the CMenuBar, and retain it in native nativeSetDefaultMenuBar(((CMenuBar)peer).getModel()); }
Example #10
Source File: _AppMenuBarHandler.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("deprecation") static void installDefaultMenuBar(final JMenuBar menuBar) { if (menuBar == null) { // intentionally clearing the default menu nativeSetDefaultMenuBar(0); return; } final MenuBarUI ui = menuBar.getUI(); if (!(ui instanceof AquaMenuBarUI)) { // Aqua was not installed throw new IllegalStateException("Application.setDefaultMenuBar() only works with the Aqua Look and Feel"); } final AquaMenuBarUI aquaUI = (AquaMenuBarUI)ui; final ScreenMenuBar screenMenuBar = aquaUI.getScreenMenuBar(); if (screenMenuBar == null) { // Aqua is installed, but we aren't using the screen menu bar throw new IllegalStateException("Application.setDefaultMenuBar() only works if apple.laf.useScreenMenuBar=true"); } screenMenuBar.addNotify(); final MenuComponentPeer peer = screenMenuBar.getPeer(); if (!(peer instanceof CMenuBar)) { // such a thing should not be possible throw new IllegalStateException("Unable to determine native menu bar from provided JMenuBar"); } // grab the pointer to the CMenuBar, and retain it in native nativeSetDefaultMenuBar(((CMenuBar)peer).getModel()); }
Example #11
Source File: _AppMenuBarHandler.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("deprecation") static void installDefaultMenuBar(final JMenuBar menuBar) { if (menuBar == null) { // intentionally clearing the default menu nativeSetDefaultMenuBar(0); return; } final MenuBarUI ui = menuBar.getUI(); if (!(ui instanceof AquaMenuBarUI)) { // Aqua was not installed throw new IllegalStateException("Application.setDefaultMenuBar() only works with the Aqua Look and Feel"); } final AquaMenuBarUI aquaUI = (AquaMenuBarUI)ui; final ScreenMenuBar screenMenuBar = aquaUI.getScreenMenuBar(); if (screenMenuBar == null) { // Aqua is installed, but we aren't using the screen menu bar throw new IllegalStateException("Application.setDefaultMenuBar() only works if apple.laf.useScreenMenuBar=true"); } screenMenuBar.addNotify(); final MenuComponentPeer peer = screenMenuBar.getPeer(); if (!(peer instanceof CMenuBar)) { // such a thing should not be possible throw new IllegalStateException("Unable to determine native menu bar from provided JMenuBar"); } // grab the pointer to the CMenuBar, and retain it in native ((CMenuBar) peer).execute(_AppMenuBarHandler::nativeSetDefaultMenuBar); }
Example #12
Source File: _AppMenuBarHandler.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("deprecation") static void installDefaultMenuBar(final JMenuBar menuBar) { if (menuBar == null) { // intentionally clearing the default menu nativeSetDefaultMenuBar(0); return; } final MenuBarUI ui = menuBar.getUI(); if (!(ui instanceof AquaMenuBarUI)) { // Aqua was not installed throw new IllegalStateException("Application.setDefaultMenuBar() only works with the Aqua Look and Feel"); } final AquaMenuBarUI aquaUI = (AquaMenuBarUI)ui; final ScreenMenuBar screenMenuBar = aquaUI.getScreenMenuBar(); if (screenMenuBar == null) { // Aqua is installed, but we aren't using the screen menu bar throw new IllegalStateException("Application.setDefaultMenuBar() only works if apple.laf.useScreenMenuBar=true"); } screenMenuBar.addNotify(); final MenuComponentPeer peer = screenMenuBar.getPeer(); if (!(peer instanceof CMenuBar)) { // such a thing should not be possible throw new IllegalStateException("Unable to determine native menu bar from provided JMenuBar"); } // grab the pointer to the CMenuBar, and retain it in native nativeSetDefaultMenuBar(((CMenuBar)peer).getModel()); }
Example #13
Source File: _AppMenuBarHandler.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("deprecation") static void installDefaultMenuBar(final JMenuBar menuBar) { if (menuBar == null) { // intentionally clearing the default menu nativeSetDefaultMenuBar(0); return; } final MenuBarUI ui = menuBar.getUI(); if (!(ui instanceof AquaMenuBarUI)) { // Aqua was not installed throw new IllegalStateException("Application.setDefaultMenuBar() only works with the Aqua Look and Feel"); } final AquaMenuBarUI aquaUI = (AquaMenuBarUI)ui; final ScreenMenuBar screenMenuBar = aquaUI.getScreenMenuBar(); if (screenMenuBar == null) { // Aqua is installed, but we aren't using the screen menu bar throw new IllegalStateException("Application.setDefaultMenuBar() only works if apple.laf.useScreenMenuBar=true"); } screenMenuBar.addNotify(); final MenuComponentPeer peer = screenMenuBar.getPeer(); if (!(peer instanceof CMenuBar)) { // such a thing should not be possible throw new IllegalStateException("Unable to determine native menu bar from provided JMenuBar"); } // grab the pointer to the CMenuBar, and retain it in native nativeSetDefaultMenuBar(((CMenuBar)peer).getModel()); }