src/java.desktop/macosx/classes/com/apple/eawt/_AppMenuBarHandler.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 30,39 ****
--- 30,40 ----
import javax.swing.*;
import javax.swing.plaf.MenuBarUI;
import com.apple.laf.ScreenMenuBar;
+ import sun.awt.AWTAccessor;
import sun.lwawt.macosx.CMenuBar;
import com.apple.laf.AquaMenuBarUI;
class _AppMenuBarHandler {
*** 47,57 ****
static _AppMenuBarHandler getInstance() {
return instance;
}
// callback from the native delegate -init function
! private static void initMenuStates(final boolean aboutMenuItemVisible, final boolean aboutMenuItemEnabled, final boolean prefsMenuItemVisible, final boolean prefsMenuItemEnabled) {
synchronized (instance) {
instance.aboutMenuItemVisible = aboutMenuItemVisible;
instance.aboutMenuItemEnabled = aboutMenuItemEnabled;
instance.prefsMenuItemVisible = prefsMenuItemVisible;
instance.prefsMenuItemEnabled = prefsMenuItemEnabled;
--- 48,61 ----
static _AppMenuBarHandler getInstance() {
return instance;
}
// callback from the native delegate -init function
! private static void initMenuStates(final boolean aboutMenuItemVisible,
! final boolean aboutMenuItemEnabled,
! final boolean prefsMenuItemVisible,
! final boolean prefsMenuItemEnabled) {
synchronized (instance) {
instance.aboutMenuItemVisible = aboutMenuItemVisible;
instance.aboutMenuItemEnabled = aboutMenuItemEnabled;
instance.prefsMenuItemVisible = prefsMenuItemVisible;
instance.prefsMenuItemEnabled = prefsMenuItemEnabled;
*** 90,100 ****
static boolean isFrameMinimized(final Frame frame) {
return (frame.getExtendedState() & Frame.ICONIFIED) != 0;
}
- @SuppressWarnings("deprecation")
static void installDefaultMenuBar(final JMenuBar menuBar) {
if (menuBar == null) {
// intentionally clearing the default menu
nativeSetDefaultMenuBar(0);
return;
--- 94,103 ----
*** 112,122 ****
// 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");
}
--- 115,125 ----
// 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");
}