summaryrefslogtreecommitdiff
path: root/javax
diff options
context:
space:
mode:
authorRoman Kennke <roman@kennke.org>2007-01-07 21:12:33 +0000
committerRoman Kennke <roman@kennke.org>2007-01-07 21:12:33 +0000
commitfb9160f48bbcba869acc08e210e92c3be1acea82 (patch)
tree196605e10f2acb8d9fcfa6e00e75c817bb81c810 /javax
parentdecd1972a517e1a88da29d2f5941e3e4d0a4a994 (diff)
downloadclasspath-fb9160f48bbcba869acc08e210e92c3be1acea82.tar.gz
2007-01-07 Roman Kennke <roman@kennke.org>
PR 30337 * java/awt/Component.java (getFontImpl): Return null when the component has no font set and also has no parent yet. * javax/swing/plaf/basic/BasicComboBoxUI.java (PropertyChangeHandler.propertyChange): Only add editor when combo box is editable. Avoid fetching the property name repeatedly. Invalidate when renderer or prototypeDisplayValue change. (uninstallComponents): Unconfigure everything and then remove all components. * javax/swing/plaf/basic/BasicComboPopup.java (uninstallingUI): Don't nullify list model. * javax/swing/plaf/metal/MetalComboBoxUI.java (createArrowButton): Pass currentValuePane to the MetalComboBoxButton constructor rather than a new (unconnected) CellRendererPane.
Diffstat (limited to 'javax')
-rw-r--r--javax/swing/plaf/basic/BasicComboBoxUI.java43
-rw-r--r--javax/swing/plaf/basic/BasicComboPopup.java1
-rw-r--r--javax/swing/plaf/metal/MetalComboBoxUI.java3
3 files changed, 25 insertions, 22 deletions
diff --git a/javax/swing/plaf/basic/BasicComboBoxUI.java b/javax/swing/plaf/basic/BasicComboBoxUI.java
index 6a95b57a2..ff636d684 100644
--- a/javax/swing/plaf/basic/BasicComboBoxUI.java
+++ b/javax/swing/plaf/basic/BasicComboBoxUI.java
@@ -489,24 +489,20 @@ public class BasicComboBoxUI extends ComboBoxUI
*/
protected void uninstallComponents()
{
- // uninstall arrow button
- unconfigureArrowButton();
- comboBox.remove(arrowButton);
- arrowButton = null;
-
- popup = null;
-
- if (comboBox.getRenderer() instanceof UIResource)
- comboBox.setRenderer(null);
+ // Unconfigure arrow button.
+ if (arrowButton != null)
+ {
+ unconfigureArrowButton();
+ }
- // 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)
+ // Unconfigure editor.
+ if (editor != null)
{
- comboBox.setEditor(null);
- editor = null;
+ unconfigureEditor();
}
+
+ comboBox.removeAll();
+ arrowButton = null;
}
/**
@@ -1349,7 +1345,7 @@ public class BasicComboBoxUI extends ComboBoxUI
comboBox.repaint();
}
- else if (propName.equals("editor"))
+ else if (propName.equals("editor") && comboBox.isEditable())
{
addEditor();
comboBox.revalidate();
@@ -1367,7 +1363,7 @@ public class BasicComboBoxUI extends ComboBoxUI
comboBox.revalidate();
}
- else if (e.getPropertyName().equals("model"))
+ else if (propName.equals("model"))
{
// remove ListDataListener from old model and add it to new model
ComboBoxModel oldModel = (ComboBoxModel) e.getOldValue();
@@ -1387,7 +1383,7 @@ public class BasicComboBoxUI extends ComboBoxUI
comboBox.revalidate();
comboBox.repaint();
}
- else if (e.getPropertyName().equals("font"))
+ else if (propName.equals("font"))
{
Font font = (Font) e.getNewValue();
if (editor != null)
@@ -1398,7 +1394,16 @@ public class BasicComboBoxUI extends ComboBoxUI
isMinimumSizeDirty = true;
comboBox.revalidate();
}
-
+ else if (propName.equals("prototypeDisplayValue"))
+ {
+ isMinimumSizeDirty = true;
+ comboBox.revalidate();
+ }
+ else if (propName.equals("renderer"))
+ {
+ isMinimumSizeDirty = true;
+ comboBox.revalidate();
+ }
// FIXME: Need to handle changes in other bound properties.
}
}
diff --git a/javax/swing/plaf/basic/BasicComboPopup.java b/javax/swing/plaf/basic/BasicComboPopup.java
index 952df5ee7..11f832ae8 100644
--- a/javax/swing/plaf/basic/BasicComboPopup.java
+++ b/javax/swing/plaf/basic/BasicComboPopup.java
@@ -282,7 +282,6 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
uninstallComboBoxModelListeners(comboBox.getModel());
uninstallKeyboardActions();
uninstallListListeners();
- list.setModel(null);
}
/**
diff --git a/javax/swing/plaf/metal/MetalComboBoxUI.java b/javax/swing/plaf/metal/MetalComboBoxUI.java
index 7aafb715d..53d49c3dc 100644
--- a/javax/swing/plaf/metal/MetalComboBoxUI.java
+++ b/javax/swing/plaf/metal/MetalComboBoxUI.java
@@ -48,7 +48,6 @@ import java.awt.event.MouseEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
-import javax.swing.CellRendererPane;
import javax.swing.ComboBoxEditor;
import javax.swing.Icon;
import javax.swing.JButton;
@@ -228,7 +227,7 @@ public class MetalComboBoxUI extends BasicComboBoxUI
protected JButton createArrowButton()
{
JButton button = new MetalComboBoxButton(comboBox, new MetalComboBoxIcon(),
- new CellRendererPane(), listBox);
+ currentValuePane, listBox);
button.setMargin(new Insets(0, 1, 1, 3));
return button;
}