-
Bug
-
Resolution: Fixed
-
P3
-
1.4.0
-
beta2
-
x86
-
windows_2000
Attached the sample code that demonstrates the JComboBox
item-selection bug. There 2 problems in this sample code:
1. one cannot select "red" without first selecting "yellow".
2. "red" should appear initially by default but does not.
Do not see both problems on 1.3 and 1.3.1
Test case
===========
import java.awt.*;
import javax.swing.*;
public class JComboBoxBug extends JFrame
{
public JComboBoxBug()
{
super();
setTitle("JComboBox Bug");
getContentPane().add(new MyJComboBoxSubclass());
pack();
}
public static void main(String[] args)
{
try {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
(new JComboBoxBug()).setVisible(true);
}
catch (Exception ex) {
ex.printStackTrace();
}
}
}
class MyJComboBoxSubclass extends JComboBox
{
String[] list = { "red", "yellow" };
public MyJComboBoxSubclass()
{
super();
loadList();
setEditable(true);
}
public void loadList()
{
setEditable(true);
for (int i = 0; i < list.length; i++){
addItem(list[i]);
}
}
}