Commit a7661a40 by Audrius Meskauskas Committed by Michael Koch

JComboBox.java (constructors): selecting the first item if the box was…

JComboBox.java (constructors): selecting the first item if the box was constructed from the provided non -...

2005-04-19  Audrius Meskauskas  <audriusa@bluewin.ch>

	* 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
parent 747a54e2
2005-04-19 Audrius Meskauskas <audriusa@bluewin.ch>
* 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 <konqueror@gmx.de> 2005-04-19 Michael Koch <konqueror@gmx.de>
* gnu/java/awt/peer/gtk/GdkGraphics.java * gnu/java/awt/peer/gtk/GdkGraphics.java
......
...@@ -185,6 +185,9 @@ public class JComboBox extends JComponent implements ItemSelectable, ...@@ -185,6 +185,9 @@ public class JComboBox extends JComponent implements ItemSelectable,
public JComboBox(Object[] itemArray) public JComboBox(Object[] itemArray)
{ {
this(new DefaultComboBoxModel(itemArray)); this(new DefaultComboBoxModel(itemArray));
if (itemArray.length > 0)
setSelectedIndex(0);
} }
/** /**
...@@ -195,6 +198,9 @@ public class JComboBox extends JComponent implements ItemSelectable, ...@@ -195,6 +198,9 @@ public class JComboBox extends JComponent implements ItemSelectable,
public JComboBox(Vector itemVector) public JComboBox(Vector itemVector)
{ {
this(new DefaultComboBoxModel(itemVector)); this(new DefaultComboBoxModel(itemVector));
if (itemVector.size() > 0)
setSelectedIndex(0);
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment