Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In most of the cases, a swing component can be seen as a multi-level model-view-controller implementor.</p> <p>From what you said, I understand that you want, when one of your objects is selected in JComboBox, put that obejct in your JList.</p> <p>First, I would suggest you to take a look at the <a href="http://java.sun.com/docs/books/tutorial/uiswing/components/combobox.html" rel="nofollow noreferrer">Swing tutorial for JComboBox</a>.</p> <p>Then, you'll see that you have some possibilites for handling events sent by JComboBox.</p> <ul> <li><a href="http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JComboBox.html#addActionListener(java.awt.event.ActionListener)" rel="nofollow noreferrer">Adding an ActionListener</a> to your JComboBox. it will be notified each time an action is performed on your JComboBox, and as a consequence quite intensively. As a consequence, it may not be the best fit.</li> <li><a href="http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JComboBox.html#addItemListener(java.awt.event.ItemListener)" rel="nofollow noreferrer">Adding an ItemListener</a> to your JComboBox. it will be notified each time selected item changes. But the number of time it gets called depends upon previous selection status.</li> </ul> <p>I suspect the second alternative is preferable to the first, since it works with combo box model data, instead of relying solely on visible component status (what first do, to a certain extend - less than a MouseListener, of course, but more than second).</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload