--- a/jdk/src/share/classes/javax/swing/MenuSelectionManager.java Mon Feb 17 13:41:50 2014 +0400
+++ b/jdk/src/share/classes/javax/swing/MenuSelectionManager.java Mon Feb 17 17:15:28 2014 +0400
@@ -30,6 +30,7 @@
import javax.swing.event.*;
import sun.awt.AppContext;
+import sun.swing.SwingUtilities2;
/**
* A MenuSelectionManager owns the selection in menu hierarchy.
@@ -60,6 +61,12 @@
if (msm == null) {
msm = new MenuSelectionManager();
context.put(MENU_SELECTION_MANAGER_KEY, msm);
+
+ // installing additional listener if found in the AppContext
+ Object o = context.get(SwingUtilities2.MENU_SELECTION_MANAGER_LISTENER_KEY);
+ if (o != null && o instanceof ChangeListener) {
+ msm.addChangeListener((ChangeListener) o);
+ }
}
return msm;
--- a/jdk/src/share/classes/sun/swing/SwingUtilities2.java Mon Feb 17 13:41:50 2014 +0400
+++ b/jdk/src/share/classes/sun/swing/SwingUtilities2.java Mon Feb 17 17:15:28 2014 +0400
@@ -80,6 +80,9 @@
public static final Object LAF_STATE_KEY =
new StringBuffer("LookAndFeel State");
+ public static final Object MENU_SELECTION_MANAGER_LISTENER_KEY =
+ new StringBuffer("MenuSelectionManager listener key");
+
// Maintain a cache of CACHE_SIZE fonts and the left side bearing
// of the characters falling into the range MIN_CHAR_INDEX to
// MAX_CHAR_INDEX. The values in fontCache are created as needed.