views:

437

answers:

2

I have a JComboBox named "jComboBox18" and a JTextArea "jTextArea11". Now I want that whenever a item is selected from the "jComboBox18" combo box its corresponding description is shown in the "jTextArea11" textarea.

I have added the appropriate listener to the JComboBox But the JTextArea is not showing any text. The code that I have written is as follows:

private void jComboBox18ItemStateChanged(java.awt.event.ItemEvent evt) {

    Object item = jComboBox18.getSelectedItem();

    if(item != null) {
        ems.logic.Process selectedProcess = (ems.logic.Process)item;

        jTextArea11.setText(selectedProcess.getProcessDescription());
        jTextArea11.updateUI();
        jTextArea11.revalidate();
        jTextArea11.validate();
    } 
}

=====================EDITED===========================================

The method is being called for sure. I am changing the state of one more combobox which is also being written in this method and its state changes successfully whenever item is selected from the "jComboBox18"

+2  A: 

I think That should work. In fact, you should only need the setText() call. My guess is that you're function isn't getting called for some reason. Put a break point in your code and make sure it's getting called.

Chad Okere
A: 
sateesh