Combobox
Key to a combox, to declare it:
String course[] = {"BCA","MCA","PPC","CIC"};
JComboBox combo=new JComboBox(course);
To get the selected item you will say:
String selectedValue=(String)combo.getSelectedItem();
If you wanted to add values (numbers 1-10 to the combobox:
someComboBox = new JComboBox();
for (int i=0;i<10;i++) {
someComboBox.addItem(i+"");
}
|