diff --git a/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java b/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java index fcfb1783605af60322b52453f8ad1596198da544..6fb52a4cd4ac3fe6004d2c020565d82a2b929708 100644 --- a/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java +++ b/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java @@ -796,9 +796,10 @@ public class GTKLookAndFeel extends SynthLookAndFeel { "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), diff --git a/src/share/classes/com/sun/java/swing/plaf/gtk/GTKStyleFactory.java b/src/share/classes/com/sun/java/swing/plaf/gtk/GTKStyleFactory.java index 5c28db4e23da26e2178fbfea693c159da93a230b..cfc2fc3ccb33d78990455c019306f2c2fba91d8b 100644 --- a/src/share/classes/com/sun/java/swing/plaf/gtk/GTKStyleFactory.java +++ b/src/share/classes/com/sun/java/swing/plaf/gtk/GTKStyleFactory.java @@ -92,7 +92,13 @@ class GTKStyleFactory extends SynthStyleFactory { 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; diff --git a/src/share/classes/javax/swing/plaf/synth/SynthMenuUI.java b/src/share/classes/javax/swing/plaf/synth/SynthMenuUI.java index 6f309861ba5a2561fec01b879f4cb7e1b3b6e019..a55aa715fe31e35a54014aef53811224b2102ba2 100644 --- a/src/share/classes/javax/swing/plaf/synth/SynthMenuUI.java +++ b/src/share/classes/javax/swing/plaf/synth/SynthMenuUI.java @@ -299,7 +299,8 @@ public class SynthMenuUI extends BasicMenuUI */ @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()); } }