[Patch][gui] BasicComboBoxUI
Michael Koch
konqueror@gmx.de
Wed Dec 22 21:59:00 GMT 2004
Hi list,
I forgot the patch to javax/swing/plaf/basic/BasicComboBoxUI.java when I
send the patch from Robert Schuster earlier. Here it is now.
Michael
-------------- next part --------------
Index: javax/swing/plaf/basic/BasicComboBoxUI.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/plaf/basic/BasicComboBoxUI.java,v
retrieving revision 1.1.2.3
diff -u -r1.1.2.3 BasicComboBoxUI.java
--- javax/swing/plaf/basic/BasicComboBoxUI.java 22 Oct 2004 12:41:22 -0000 1.1.2.3
+++ javax/swing/plaf/basic/BasicComboBoxUI.java 22 Dec 2004 21:43:47 -0000
@@ -80,6 +80,7 @@
* UI Delegate for JComboBox
*
* @author Olga Rodimina
+ * @author Robert Schuster
*/
public class BasicComboBoxUI extends ComboBoxUI
{
@@ -783,22 +784,25 @@
{
Object currentValue = comboBox.getSelectedItem();
boolean isPressed = arrowButton.getModel().isPressed();
- if (currentValue != null)
- {
- Component comp = comboBox.getRenderer()
+
+ /* Gets the component to be drawn for the current value.
+ * If there is currently no selected item we will take an empty
+ * String as replacement.
+ */
+ Component comp = comboBox.getRenderer()
.getListCellRendererComponent(listBox,
- currentValue,
+ (currentValue != null ? currentValue : ""),
-1,
isPressed,
hasFocus);
- if (! comboBox.isEnabled())
+ if (! comboBox.isEnabled())
comp.setEnabled(false);
- g.translate(borderInsets.left, borderInsets.top);
+ g.translate(borderInsets.left, borderInsets.top);
comp.setBounds(0, 0, bounds.width, bounds.height);
comp.paint(g);
g.translate(-borderInsets.left, -borderInsets.top);
- }
+
comboBox.revalidate();
}
else
More information about the Java-patches
mailing list