Java examples for Swing:JComboBox
Create JComboBox using a Vector of String as the list of choices
import java.util.Vector; import javax.swing.JComboBox; public class Main { public static void main(String[] args) { Vector<String> sList2 = new Vector<>(4); sList2.add("Spring"); sList2.add("Summer"); sList2.add("Fall"); sList2.add("Winter"); JComboBox<String> seasons2 = new JComboBox<>(sList2); }/*from ww w. ja va 2s . c o m*/ }