classpath-patches
[Top][All Lists]
Advanced

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

[cp-patches] FYI: BasicComboBoxUI fixlet


From: David Gilbert
Subject: [cp-patches] FYI: BasicComboBoxUI fixlet
Date: Tue, 18 Oct 2005 16:28:56 +0100
User-agent: Mozilla Thunderbird 1.0.6 (X11/20050728)

I commited this patch to fix a failing Mauve test:

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

        * javax/swing/plaf/basic/BasicComboBoxUI.java
        (installComponents): only set default editor if the current editor is
        null or implements UIResource,
        (uninstallComponents): only clear editor if it implements UIResource.

Regards,

Dave
Index: javax/swing/plaf/basic/BasicComboBoxUI.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicComboBoxUI.java,v
retrieving revision 1.24
diff -u -r1.24 BasicComboBoxUI.java
--- javax/swing/plaf/basic/BasicComboBoxUI.java 18 Oct 2005 11:05:10 -0000      
1.24
+++ javax/swing/plaf/basic/BasicComboBoxUI.java 18 Oct 2005 15:12:59 -0000
@@ -476,8 +476,12 @@
     configureArrowButton();
     comboBox.add(arrowButton);
 
-    comboBox.setEditor(createEditor());
-    editor = comboBox.getEditor().getEditorComponent();
+    ComboBoxEditor currentEditor = comboBox.getEditor();
+    if (currentEditor == null || currentEditor instanceof UIResource)
+      {
+        comboBox.setEditor(createEditor());
+        editor = comboBox.getEditor().getEditorComponent();
+      }
 
     comboBox.revalidate();
   }
@@ -499,8 +503,14 @@
 
     comboBox.setRenderer(null);
 
-    comboBox.setEditor(null);
-    editor = null;
+    // if the editor is not an instanceof UIResource, it was not set by the
+    // UI delegate, so don't clear it...
+    ComboBoxEditor currentEditor = comboBox.getEditor();
+    if (currentEditor instanceof UIResource)
+      {
+        comboBox.setEditor(null);
+        editor = null;
+      }
   }
 
   /**

reply via email to

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