src/macosx/classes/com/apple/eawt/_AppMenuBarHandler.java
Print this page
*** 29,38 ****
--- 29,39 ----
import java.awt.peer.MenuComponentPeer;
import javax.swing.*;
import javax.swing.plaf.MenuBarUI;
+ import com.apple.laf.ScreenMenuBar;
import sun.lwawt.macosx.CMenuBar;
import com.apple.laf.AquaMenuBarUI;
class _AppMenuBarHandler {
*** 70,85 ****
installDefaultMenuBar(menuBar);
// scan the current frames, and see if any are foreground
final Frame[] frames = Frame.getFrames();
for (final Frame frame : frames) {
! if (frame.isVisible() && !isFrameMinimized(frame)) return;
}
// if we have no foreground frames, then we have to "kick" the menubar
final JFrame pingFrame = new JFrame();
pingFrame.getRootPane().putClientProperty("Window.alpha", new Float(0.0f));
pingFrame.setVisible(true);
pingFrame.toFront();
pingFrame.setVisible(false);
pingFrame.dispose();
}
--- 71,89 ----
installDefaultMenuBar(menuBar);
// scan the current frames, and see if any are foreground
final Frame[] frames = Frame.getFrames();
for (final Frame frame : frames) {
! if (frame.isVisible() && !isFrameMinimized(frame)) {
! return;
! }
}
// if we have no foreground frames, then we have to "kick" the menubar
final JFrame pingFrame = new JFrame();
pingFrame.getRootPane().putClientProperty("Window.alpha", new Float(0.0f));
+ pingFrame.setUndecorated(true);
pingFrame.setVisible(true);
pingFrame.toFront();
pingFrame.setVisible(false);
pingFrame.dispose();
}
*** 99,109 ****
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
--- 103,112 ----
*** 116,127 ****
// 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());
! */
}
void setAboutMenuItemVisible(final boolean present) {
synchronized (this) {
if (aboutMenuItemVisible == present) return;
--- 119,129 ----
// 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());
}
void setAboutMenuItemVisible(final boolean present) {
synchronized (this) {
if (aboutMenuItemVisible == present) return;