Thanks Roman; I didn't know that would work - the MenuSelectionManager
is smarter than I thought! =)
Attached is a patch to finish it up; I'll commit it if there are no
objections.
Francis
2006-06-14 Francis Kung <[EMAIL PROTECTED]>
* javax/swing/plaf/basic/BasicArrowButton.java:
(BasicArrowButton): move client property for not triggering out
of consturctor
* javax/swing/plaf/basic/BasicComboBoxUI.java:
(configureArrowButton): set client property for not triggering
(installUI): set client property for not triggering
* javax/swing/plaf/basic/BasicLookAndFeel.java:
(PopupHelper.mousePressed): check client property for triggering
Index: javax/swing/plaf/basic/BasicArrowButton.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicArrowButton.java,v
retrieving revision 1.18
diff -u -r1.18 BasicArrowButton.java
--- javax/swing/plaf/basic/BasicArrowButton.java 13 Jun 2006 19:41:22 -0000 1.18
+++ javax/swing/plaf/basic/BasicArrowButton.java 14 Jun 2006 14:36:48 -0000
@@ -116,8 +116,6 @@
this.shadow = shadow;
this.darkShadow = darkShadow;
this.highlight = highlight;
- // Mark the button as not closing the popup, we handle this ourselves.
- putClientProperty(BasicLookAndFeel.DONT_CANCEL_POPUP, Boolean.TRUE);
}
/**
Index: javax/swing/plaf/basic/BasicComboBoxUI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicComboBoxUI.java,v
retrieving revision 1.37
diff -u -r1.37 BasicComboBoxUI.java
--- javax/swing/plaf/basic/BasicComboBoxUI.java 13 Jun 2006 09:28:57 -0000 1.37
+++ javax/swing/plaf/basic/BasicComboBoxUI.java 14 Jun 2006 14:36:48 -0000
@@ -241,6 +241,8 @@
comboBox.setLayout(createLayoutManager());
comboBox.setFocusable(true);
installKeyboardActions();
+ comboBox.putClientProperty(BasicLookAndFeel.DONT_CANCEL_POPUP,
+ Boolean.TRUE);
}
}
@@ -571,6 +573,10 @@
arrowButton.addMouseListener(popupMouseListener);
if (popupMouseMotionListener != null)
arrowButton.addMouseMotionListener(popupMouseMotionListener);
+
+ // Mark the button as not closing the popup, we handle this ourselves.
+ arrowButton.putClientProperty(BasicLookAndFeel.DONT_CANCEL_POPUP,
+ Boolean.TRUE);
}
}
Index: javax/swing/plaf/basic/BasicLookAndFeel.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicLookAndFeel.java,v
retrieving revision 1.95
diff -u -r1.95 BasicLookAndFeel.java
--- BasicLookAndFeel.java 13 Jun 2006 19:41:22 -0000 1.95
+++ BasicLookAndFeel.java 14 Jun 2006 16:03:48 -0000
@@ -64,6 +64,7 @@
import javax.swing.Action;
import javax.swing.ActionMap;
import javax.swing.BorderFactory;
+import javax.swing.JComponent;
import javax.swing.KeyStroke;
import javax.swing.LookAndFeel;
import javax.swing.MenuSelectionManager;
@@ -129,7 +130,9 @@
if (target instanceof Container)
target = ((Container) target).findComponentAt(ev.getPoint());
if (m.getSelectedPath().length > 0
- && ! m.isComponentPartOfCurrentMenu(target))
+ && ! m.isComponentPartOfCurrentMenu(target)
+ && (((JComponent)target).getClientProperty(DONT_CANCEL_POPUP) == null
+ || !((JComponent)target).getClientProperty(DONT_CANCEL_POPUP).equals(Boolean.TRUE)))
{
m.clearSelectedPath();
}