Hi
I am a beginner with Java.
I have JBuilder Personal version on my PC.

I was given an exercise to create a ComboBox (below). I can do all but part
10. I cannot figure out which property to change so the combo box displays
all the countries and there is no need to scroll.

Thanks
etwas


1) Select File | Close Projects from the JBuilder Menus
2) Create a new project called Exercise4 and set its properties as in the
previous exercises
3) Create a new application as in the previous exercises. Change the names
to reflect the new project. Remember to set the layout property of the content
pane component to null.
4) Add a combo box from the Swing palette to the frame (javax.swing.JComboBox)
5) Add items to the combo box by adding the following code in the jbInit()
method in Frame1

jComboBox1.addItem("Australia");
jComboBox1.addItem("China");
jComboBox1.addItem("Hong Kong");
jComboBox1.addItem("India");
jComboBox1.addItem("Indonesia");
jComboBox1.addItem("Israel");
jComboBox1.addItem("Malaysia");
jComboBox1.addItem("Singapore");
jComboBox1.addItem("Thailand");

6) Save the project and then run the project. You should have a frame appear
which has the six options visible when you drop down the combo box
7) Add a label to the frame with the name property countryName and with the
title property “No Country Selected”
8) For the action_performed event of the combo box, add the following method

void jComboBox1_actionPerformed(ActionEvent e) {

String selectedCountry = (String)jComboBox1.getSelectedItem();
countrySelected.setText(selectedCountry);
}

9) Run the program and see how as we change the selected item in the combo
box, the contents of the label are changed.
10) Change the program so that all the countries are displayed when you open
the combo box and there is no need to scroll.