Java 类javax.swing.plaf.MenuBarUI 实例源码

项目:JRLib    文件:SubstanceInternalFrameTitlePane.java   
/**
 * 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);
}
项目:OpenJSharp    文件:_AppMenuBarHandler.java   
@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());
}
项目:jdk8u-jdk    文件:_AppMenuBarHandler.java   
@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);
}
项目:openjdk-jdk10    文件:JMenuBarOperator.java   
/**
 * Maps {@code JMenuBar.getUI()} through queue
 */
public MenuBarUI getUI() {
    return (runMapping(new MapAction<MenuBarUI>("getUI") {
        @Override
        public MenuBarUI map() {
            return ((JMenuBar) getSource()).getUI();
        }
    }));
}
项目:openjdk-jdk10    文件:JMenuBarOperator.java   
/**
 * 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);
        }
    });
}
项目:openjdk9    文件:_AppMenuBarHandler.java   
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 Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(screenMenuBar);
    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());
}
项目:openjdk9    文件:JMenuBarOperator.java   
/**
 * Maps {@code JMenuBar.getUI()} through queue
 */
public MenuBarUI getUI() {
    return (runMapping(new MapAction<MenuBarUI>("getUI") {
        @Override
        public MenuBarUI map() {
            return ((JMenuBar) getSource()).getUI();
        }
    }));
}
项目:openjdk9    文件:JMenuBarOperator.java   
/**
 * 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);
        }
    });
}
项目:jdk8u_jdk    文件:_AppMenuBarHandler.java   
@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);
}
项目:lookaside_java-1.8.0-openjdk    文件:_AppMenuBarHandler.java   
@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);
}
项目:infobip-open-jdk-8    文件:_AppMenuBarHandler.java   
@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());
}
项目:jdk8u-dev-jdk    文件:_AppMenuBarHandler.java   
@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());
}
项目:OLD-OpenJDK8    文件:_AppMenuBarHandler.java   
@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());
}
项目:cn1    文件:JMenuBarTest.java   
public void testSetUIMenuBarUI() {
    MenuBarUI ui1 = new BasicMenuBarUI();
    MenuBarUI ui2 = new MetalMenuBarUI();
    JMenuBar menuBar = new JMenuBar();
    menuBar.setUI(ui1);
    assertSame(ui1, menuBar.getUI());
    menuBar.setUI(ui2);
    assertSame(ui2, menuBar.getUI());
}
项目:openjdk-jdk7u-jdk    文件:_AppMenuBarHandler.java   
@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());
}
项目:freeVM    文件:JMenuBarTest.java   
public void testSetUIMenuBarUI() {
    MenuBarUI ui1 = new BasicMenuBarUI();
    MenuBarUI ui2 = new MetalMenuBarUI();
    JMenuBar menuBar = new JMenuBar();
    menuBar.setUI(ui1);
    assertSame(ui1, menuBar.getUI());
    menuBar.setUI(ui2);
    assertSame(ui2, menuBar.getUI());
}
项目:freeVM    文件:JMenuBarTest.java   
public void testSetUIMenuBarUI() {
    MenuBarUI ui1 = new BasicMenuBarUI();
    MenuBarUI ui2 = new MetalMenuBarUI();
    JMenuBar menuBar = new JMenuBar();
    menuBar.setUI(ui1);
    assertSame(ui1, menuBar.getUI());
    menuBar.setUI(ui2);
    assertSame(ui2, menuBar.getUI());
}
项目:openjdk-icedtea7    文件:_AppMenuBarHandler.java   
@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");
        }
/* TODO: disabled until ScreenMenuBar is working

        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).getNativeMenuBarPeer());
*/
    }
项目:workcraft    文件:MainWindow.java   
public void startup() {
    MainWindowIconManager.apply(this);
    JDialog.setDefaultLookAndFeelDecorated(true);
    UIManager.put(SubstanceLookAndFeel.TABBED_PANE_CONTENT_BORDER_KIND, TabContentPaneBorderKind.SINGLE_FULL);
    setTitle(TITLE_WORKCRAFT);

    // Create main menu.
    mainMenu = new MainMenu(this);
    MenuBarUI menuUI = mainMenu.getUI();
    setJMenuBar(mainMenu);

    // 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);
    rootDockingPort = new DefaultDockingPort(FLEXDOCK_DOCKING_PORT);
    content.add(rootDockingPort, BorderLayout.CENTER);
    StandardBorderManager borderManager = new StandardBorderManager(new ShadowBorder());
    rootDockingPort.setBorderManager(borderManager);

    // Create toolbars.
    globalToolbar = new ToolBar(this);
    modelToolbar = new JToolBar("Model tools");
    controlToolbar = new JToolBar("Tool controls");
    mainMenu.registerToolbar(globalToolbar);
    mainMenu.registerToolbar(modelToolbar);
    mainMenu.registerToolbar(controlToolbar);
    loadToolbarParametersFromConfig();

    // Create dockable windows.
    createWindows();
    createDockingLayout();
    loadWindowGeometryFromConfig();
    loadRecentFilesFromConfig();

    // Display window in its default state.
    setVisible(true);
    DockableWindow.updateHeaders(rootDockingPort, getDefaultActionListener());
    DockingManager.display(outputDockable);
    utilityWindows.add(documentPlaceholder);

    new Thread(new Runnable() {
        @Override
        public void run() {
            // 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.
            GUI.createIconFromSVG("images/icon.svg");
        }
    }).start();

    setWorkActionsEnableness(false);
}
项目:j2se_for_android    文件:JMenuBar.java   
public MenuBarUI getUI() {
    return null;
}
项目:j2se_for_android    文件:JMenuBar.java   
public void setUI(MenuBarUI ui) {
    super.setUI(ui);
}
项目:javify    文件:JMenuBar.java   
/**
 * Set the "UI" property to a class constructed, via the {@link
 * UIManager}, from the current look and feel.
 */
public void updateUI()
{
  setUI((MenuBarUI) UIManager.getUI(this));
}
项目:jvm-stm    文件:JMenuBar.java   
/**
 * Set the "UI" property to a class constructed, via the {@link
 * UIManager}, from the current look and feel.
 */
public void updateUI()
{
  setUI((MenuBarUI) UIManager.getUI(this));
}
项目:cn1    文件:JMenuBar.java   
public MenuBarUI getUI() {
    return (MenuBarUI) ui;
}
项目:cn1    文件:JMenuBar.java   
public void setUI(MenuBarUI ui) {
    super.setUI(ui);
}
项目:cn1    文件:JMenuBar.java   
@Override
public void updateUI() {
    setUI((MenuBarUI) UIManager.getUI(this));
}
项目:JamVM-PH    文件:JMenuBar.java   
/**
 * Set the "UI" property to a class constructed, via the {@link
 * UIManager}, from the current look and feel.
 */
public void updateUI()
{
  setUI((MenuBarUI) UIManager.getUI(this));
}
项目:classpath    文件:JMenuBar.java   
/**
 * Set the "UI" property to a class constructed, via the {@link
 * UIManager}, from the current look and feel.
 */
public void updateUI()
{
  setUI((MenuBarUI) UIManager.getUI(this));
}
项目:freeVM    文件:JMenuBar.java   
public MenuBarUI getUI() {
    return (MenuBarUI) ui;
}
项目:freeVM    文件:JMenuBar.java   
public void setUI(MenuBarUI ui) {
    super.setUI(ui);
}
项目:freeVM    文件:JMenuBar.java   
@Override
public void updateUI() {
    setUI((MenuBarUI) UIManager.getUI(this));
}
项目:freeVM    文件:JMenuBar.java   
public MenuBarUI getUI() {
    return (MenuBarUI) ui;
}
项目:freeVM    文件:JMenuBar.java   
public void setUI(MenuBarUI ui) {
    super.setUI(ui);
}
项目:freeVM    文件:JMenuBar.java   
@Override
public void updateUI() {
    setUI((MenuBarUI) UIManager.getUI(this));
}
项目:javify    文件:JMenuBar.java   
/**
  * Set the "UI" property of the menu bar, which is a look and feel class
  * responsible for handling the menuBar's input events and painting it.
  *
  * @return The current "UI" property
  */
public MenuBarUI getUI()
{
  return (MenuBarUI) ui;
}
项目:javify    文件:JMenuBar.java   
/**
 * Set the "UI" property of the menu bar, which is a look and feel class
 * responsible for handling menuBar's input events and painting it.
 *
 * @param ui The new "UI" property
 */
public void setUI(MenuBarUI ui)
{
  super.setUI(ui);
}
项目:jvm-stm    文件:JMenuBar.java   
/**
  * Set the "UI" property of the menu bar, which is a look and feel class
  * responsible for handling the menuBar's input events and painting it.
  *
  * @return The current "UI" property
  */
public MenuBarUI getUI()
{
  return (MenuBarUI) ui;
}
项目:jvm-stm    文件:JMenuBar.java   
/**
 * Set the "UI" property of the menu bar, which is a look and feel class
 * responsible for handling menuBar's input events and painting it.
 *
 * @param ui The new "UI" property
 */
public void setUI(MenuBarUI ui)
{
  super.setUI(ui);
}
项目:JamVM-PH    文件:JMenuBar.java   
/**
  * Set the "UI" property of the menu bar, which is a look and feel class
  * responsible for handling the menuBar's input events and painting it.
  *
  * @return The current "UI" property
  */
public MenuBarUI getUI()
{
  return (MenuBarUI) ui;
}
项目:JamVM-PH    文件:JMenuBar.java   
/**
 * Set the "UI" property of the menu bar, which is a look and feel class
 * responsible for handling menuBar's input events and painting it.
 *
 * @param ui The new "UI" property
 */
public void setUI(MenuBarUI ui)
{
  super.setUI(ui);
}