--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java Wed Jun 27 12:54:48 2012 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java Thu Jun 28 14:05:06 2012 +0400
@@ -796,9 +796,10 @@
"Menu.margin", zeroInsets,
"Menu.cancelMode", "hideMenuTree",
"Menu.alignAcceleratorText", Boolean.FALSE,
+ "Menu.useMenuBarForTopLevelMenus", Boolean.TRUE,
- "MenuBar.windowBindings", new Object[] {
+ "MenuBar.windowBindings", new Object[] {
"F10", "takeFocus" },
"MenuBar.font", new FontLazyValue(Region.MENU_BAR),
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKStyleFactory.java Wed Jun 27 12:54:48 2012 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKStyleFactory.java Thu Jun 28 14:05:06 2012 +0400
@@ -92,7 +92,13 @@
boolean defaultCapable = btn.isDefaultCapable();
key = new ComplexKey(wt, toolButton, defaultCapable);
}
+ } else if (id == Region.MENU) {
+ if (c instanceof JMenu && ((JMenu) c).isTopLevelMenu() &&
+ UIManager.getBoolean("Menu.useMenuBarForTopLevelMenus")) {
+ wt = WidgetType.MENU_BAR;
+ }
}
+
if (key == null) {
// Otherwise, just use the WidgetType as the key.
key = wt;
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuUI.java Wed Jun 27 12:54:48 2012 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuUI.java Thu Jun 28 14:05:06 2012 +0400
@@ -299,7 +299,8 @@
*/
@Override
public void propertyChange(PropertyChangeEvent e) {
- if (SynthLookAndFeel.shouldUpdateStyle(e)) {
+ if (SynthLookAndFeel.shouldUpdateStyle(e) ||
+ (e.getPropertyName().equals("ancestor") && UIManager.getBoolean("Menu.useMenuBarForTopLevelMenus"))) {
updateStyle((JMenu)e.getSource());
}
}