javax.swing.plaf.MenuBarUI Java Examples
The following examples show how to use
javax.swing.plaf.MenuBarUI.
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: SubstanceInternalFrameTitlePane.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Uninstalls <code>this</code> title pane. */ public void uninstall() { if ((this.menuBar != null) && (this.menuBar.getMenuCount() > 0)) { MenuBarUI menuBarUI = this.menuBar.getUI(); if (menuBarUI instanceof SubstanceMenuBarUI) { SubstanceMenuBarUI ui = (SubstanceMenuBarUI) menuBarUI; if (ui.getMenuBar() == this.menuBar) menuBarUI.uninstallUI(this.menuBar); } SubstanceCoreUtilities.uninstallMenu(this.menuBar.getMenu(0)); this.remove(menuBar); // fix for issue 362 - remove the buttons so that we don't // have duplicate buttons on internal frames in reparented // desktop panes this.remove(maxButton); this.remove(closeButton); this.remove(iconButton); } this.uninstallListeners(); this.putClientProperty(UNINSTALLED, Boolean.TRUE); }
Example #2
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 #3
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 #4
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 #5
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 #6
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 #7
Source File: JMenuBarOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Maps {@code JMenuBar.getUI()} through queue */ public MenuBarUI getUI() { return (runMapping(new MapAction<MenuBarUI>("getUI") { @Override public MenuBarUI map() { return ((JMenuBar) getSource()).getUI(); } })); }
Example #8
Source File: JMenuBarOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Maps {@code JMenuBar.setUI(MenuBarUI)} through queue */ public void setUI(final MenuBarUI menuBarUI) { runMapping(new MapVoidAction("setUI") { @Override public void map() { ((JMenuBar) getSource()).setUI(menuBarUI); } }); }
Example #9
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 #10
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 #11
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 #12
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 #13
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 #14
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 #15
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()); }
Example #16
Source File: MainWindow.java From workcraft with MIT License | 4 votes |
public void startup() { MainWindowIconManager.apply(this); JDialog.setDefaultLookAndFeelDecorated(true); setTitle(TITLE_WORKCRAFT); // Create main menu mainMenu = new MainMenu(); MenuBarUI menuUI = mainMenu.getUI(); setJMenuBar(mainMenu); mainMenu.updateRecentMenu(); // Tweak look-and-feel SilverOceanTheme.enable(); LookAndFeelHelper.setDefaultLookAndFeel(); SwingUtilities.updateComponentTreeUI(this); if (DesktopApi.getOs().isMac()) { // Menu UI needs to be restored for OSX (global menu Look-and-Feel) mainMenu.setUI(menuUI); } // Create content panel and docking ports layout = new MultiBorderLayout(); content = new JPanel(layout); setContentPane(content); defaultDockingPort = new DefaultDockingPort(FLEXDOCK_DOCKING_PORT); content.add(defaultDockingPort, BorderLayout.CENTER); StandardBorderManager borderManager = new StandardBorderManager(new ShadowBorder()); defaultDockingPort.setBorderManager(borderManager); // Create toolbars globalToolbar = new ToolBar(); modelToolbar = new JToolBar(TITLE_MODEL_TOOLS); controlToolbar = new JToolBar(TITLE_TOOL_CONTROLS); mainMenu.registerToolbar(globalToolbar); mainMenu.registerToolbar(modelToolbar); mainMenu.registerToolbar(controlToolbar); loadToolbarParametersFromConfig(); // Create dockable windows createWindows(); createDockingLayout(); loadWindowGeometryFromConfig(); // Display window in its default state setVisible(true); DockingUtils.updateHeaders(defaultDockingPort); DockingManager.display(outputDockable); utilityWindows.add(documentPlaceholder); setWorkActionsEnableness(false); updateDockableWindowVisibility(); new Thread(() -> { // Hack to fix the annoying delay occurring when createGlyphVector is called for the first time Font font = new Font(Font.SANS_SERIF, Font.PLAIN, 1); FontRenderContext frc = new FontRenderContext(new AffineTransform(), true, true); font.createGlyphVector(frc, TITLE_PLACEHOLDER); // Force SVG rendering classes to load GuiUtils.createIconFromSVG("images/icon.svg"); }).start(); }