summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Kennke <roman@kennke.org>2006-02-24 16:43:33 +0000
committerRoman Kennke <roman@kennke.org>2006-02-24 16:43:33 +0000
commit245b35c4ae8a6c28dc9dd3c7d157c189f3a55ebf (patch)
treef440ec1031ee87aaca6277f445be348e84685535
parenta345b27a579ae46b6d309ca8940a7d09f508191a (diff)
downloadclasspath-245b35c4ae8a6c28dc9dd3c7d157c189f3a55ebf.tar.gz
2006-02-24 Roman Kennke <kennke@aicas.com>
* javax/swing/plaf/basic/BasicComboPopup.java (show): Register the popup with the autocloser after it has been opened completely, by putting the registration on the eventqueue.
-rw-r--r--ChangeLog6
-rw-r--r--javax/swing/plaf/basic/BasicComboPopup.java18
2 files changed, 20 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 710b075dd..780102a99 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-02-24 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicComboPopup.java
+ (show): Register the popup with the autocloser after it has been
+ opened completely, by putting the registration on the eventqueue.
+
2006-02-24 Andrew John Hughes <gnu_andrew@member.fsf.org>
* gnu/java/security/prng/BasePRNG.java:
diff --git a/javax/swing/plaf/basic/BasicComboPopup.java b/javax/swing/plaf/basic/BasicComboPopup.java
index 23e139003..798101d0d 100644
--- a/javax/swing/plaf/basic/BasicComboPopup.java
+++ b/javax/swing/plaf/basic/BasicComboPopup.java
@@ -194,13 +194,23 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
if (selectedIndex > comboBox.getMaximumRowCount())
scrollbar.setValue(getPopupHeightForRowCount(selectedIndex));
- // Register this popup to be autoclosed when user clicks outside the
- // popup.
- BasicLookAndFeel laf = (BasicLookAndFeel) UIManager.getLookAndFeel();
- laf.registerForAutoClose(this);
+ // We put the autoclose-registration inside an InvocationEvent, so that
+ // the same event that triggered this show() call won't hide the popup
+ // immediately.
+ SwingUtilities.invokeLater
+ (new Runnable()
+ {
+ public void run()
+ {
+ // Register this popup to be autoclosed when user clicks outside the
+ // popup.
+ BasicLookAndFeel laf = (BasicLookAndFeel) UIManager.getLookAndFeel();
+ laf.registerForAutoClose(BasicComboPopup.this);
+ }});
// location specified is relative to comboBox
super.show(comboBox, 0, cbBounds.height);
+
}
/**