To create the event:
1- Return to the UI Editor, select the OK button, and in the Property Inspector select the Events tab.
2- Locate the actionPerformed event (at the top of the list), and in the field to the fight, type displayIt.
3- When you press Enter, the Code Editor should be displayed automatically with the cursor in the correct place to add code between the curly braces of the displayIt() method. If not, open the Code Editor and scroll down until you see the code for the method:
void displayIt(ActionEvent e)
{
}
4- Add the following code between the curly braces:
if (jComboBox1.getSelectedItem()== "0") {
jTextField1.setText("Not fully entered");
}
if (jComboBox1.getSelectedItem()== "1") {
jTextField1.setText("Entered");
}
if (jComboBox1.getSelectedItem()== "2") {
jTextField1.setText("Canceled - bad credit");
}
if (jComboBox1.getSelectedItem()== "3") {
jTextField1.setText("Canceled - by customer");
}
if (jComboBox1.getSelectedItem()== "4") {
jTextField1.setText("Shipped - whole order");
}
if (jComboBox1.getSelectedItem()== "5") {
jTextField1.setText("Shipped - replacement items");
}
if (jComboBox1.getSelectedItem()== "6") {
jTextField1.setText("Shipped - backlog on items");
}
if (jComboBox1.getSelectedItem()== "7") {
jTextField1.setText("Shipped - special delivery");
}
if (jComboBox1.getSelectedItem()== "8") {
jTextField1.setText("Shipped - billed");
}
if (jComboBox1.getSelectedItem()== "9") {
jTextField1.setText("Shipped - payment plan");
}
if (jComboBox1.getSelectedItem()== "10") {
jTextField1.setText("Shipped - paid");
}
5- Return to the UI Editor and select the JTextField component.
6- In the Property Inspector, with the Property tab selected, locate the text property and delete the text jTextField1. Locate the editable property and change it to False.
With the editable property set to False, the user will not be able to edit this field. For the UI you are designing, this means that once the user has selected a status code from the combo box, the next control that is enabled is the OK button.
Save your work before proceeding.
Now that you have created the user interface, the next task is to create an application from which to run it. To do this, go on to Step 3: Creating an Application for the UI.