7094099: DropDown List of JComboBox detached
authoranashaty
Mon, 17 Feb 2014 17:15:28 +0400
changeset 23298 1c729daf92a0
parent 23297 2946ef51ee24
child 23299 6a715c2969cf
7094099: DropDown List of JComboBox detached Reviewed-by: alexp, alexsch
jdk/src/share/classes/javax/swing/MenuSelectionManager.java
jdk/src/share/classes/sun/swing/SwingUtilities2.java
--- 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.