From a7661a40879050ef23073fc92311968538546e91 Mon Sep 17 00:00:00 2001 From: Audrius Meskauskas Date: Tue, 19 Apr 2005 07:23:13 +0200 Subject: [PATCH] JComboBox.java (constructors): selecting the first item if the box was constructed from the provided non -... 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. From-SVN: r98376 --- libjava/ChangeLog | 6 ++++++ libjava/javax/swing/JComboBox.java | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 2f889b3df92..cb22bfee058 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 4e2a88110fc..078c77df436 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.30.2