classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] FYI: BasicComboBoxUI


From: David Gilbert
Subject: [cp-patches] FYI: BasicComboBoxUI
Date: Mon, 17 Oct 2005 17:20:26 +0000
User-agent: Mozilla Thunderbird 1.0.6 (X11/20050728)

This patch (committed) ensures that the editable text field in a JComboBox is updated when the selection changes, and fixes a problem I was having with the JUnit TestRunner:

2005-10-17  David Gilbert  <address@hidden>

        * javax/swing/plaf/basic/BasicComboBoxUI.java
        (ItemHandler.itemStateChanged): if combo box is editable, update edit
        text field with new selection.

Regards,

Dave
Index: javax/swing/plaf/basic/BasicComboBoxUI.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicComboBoxUI.java,v
retrieving revision 1.22
diff -u -r1.22 BasicComboBoxUI.java
--- javax/swing/plaf/basic/BasicComboBoxUI.java 17 Oct 2005 13:35:58 -0000      
1.22
+++ javax/swing/plaf/basic/BasicComboBoxUI.java 17 Oct 2005 16:12:56 -0000
@@ -1021,6 +1021,8 @@
      */
     public void itemStateChanged(ItemEvent e)
     {
+      if (e.getStateChange() == ItemEvent.SELECTED && comboBox.isEditable())
+        comboBox.getEditor().setItem(e.getItem());
       comboBox.repaint();
     }
   }

reply via email to

[Prev in Thread] Current Thread [Next in Thread]