The scrollbar in JComboBox appears only for the first click and then disappears for the subsequent clicks.
Steps To Reproduce:
1. Run the testcase pasted below.
2. Click the first comboBox which has a single item .Observe the Scrollbar.
Now click the Combobox again , the Scrollbar disappears.
This happens for less than 9 items added.
3. Click on the second ComboBox which has nine items , the Scrollbar remains even after the
subsequent clicks.
import javax.swing.JFrame;
import javax.swing.JComboBox;
import java.util.Vector;
public class ScrollBarVisibleBug {
JFrame frame = null;
JComboBox combo1=null;
JComboBox combo2= null;
ScrollBarVisibleBug(){
frame = new JFrame();
frame.setLayout(new java.awt.FlowLayout());
Vector items1 = new Vector();
items1.add("karen");
frame.add(combo1 = new JComboBox(items1));
Vector items2 = new Vector();
items2.add("One");
items2.add("two");
items2.add("three");
items2.add("four");
items2.add("five");
items2.add("six");
items2.add("seven");
items2.add("eight");
items2.add("nine");
frame.add(combo2 = new JComboBox(items2));
frame.setSize(300,300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
public static void main(String []args){
javax.swing.SwingUtilities.invokeLater(new Runnable(){
public void run(){
new ScrollBarVisibleBug();
}
});
}
}