From b23b5b6c3bcfcf85efd7b13b07818d3ae515066a Mon Sep 17 00:00:00 2001 From: mkoch Date: Tue, 19 Apr 2005 05:23:13 +0000 Subject: [PATCH] 2005-04-19 Audrius Meskauskas * javax/swing/JComboBox.java (constructors): selecting the first item if the box was constructed from the provided non - empty array or vector. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@98376 138bc75d-0d04-0410-961f-82ee72b054a4 --- libjava/ChangeLog | 6 ++++++ libjava/javax/swing/JComboBox.java | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 2f889b3d..cb22bfe 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,9 @@ +2005-04-19 Audrius Meskauskas + + * javax/swing/JComboBox.java (constructors): selecting the + first item if the box was constructed from the provided + non - empty array or vector. + 2005-04-19 Michael Koch * gnu/java/awt/peer/gtk/GdkGraphics.java diff --git a/libjava/javax/swing/JComboBox.java b/libjava/javax/swing/JComboBox.java index 4e2a881..078c77d 100644 --- a/libjava/javax/swing/JComboBox.java +++ b/libjava/javax/swing/JComboBox.java @@ -185,6 +185,9 @@ public class JComboBox extends JComponent implements ItemSelectable, public JComboBox(Object[] itemArray) { this(new DefaultComboBoxModel(itemArray)); + + if (itemArray.length > 0) + setSelectedIndex(0); } /** @@ -195,6 +198,9 @@ public class JComboBox extends JComponent implements ItemSelectable, public JComboBox(Vector itemVector) { this(new DefaultComboBoxModel(itemVector)); + + if (itemVector.size() > 0) + setSelectedIndex(0); } /** -- 2.7.4