The example contains two JLabels, two JTextFields and a JComboBox. Note, the above screen shows Java Swing JComboBox as an editable type. When the user selects an item in the combo box, we show that in the first text box. We also show the past selected item in the Deselected JTextField. A combo box can show only one item once the drop-down is collapsed. So when the user picks an item, in combo box point of view, one item was selected by the user and one was de-selected (the previous one).
Tag Archive for ‘ItemEvent’
The example contains three components. One is a JLabel which tells in what mode the example is in. The button labelled OFF is the JToggleButton and it will switch the state between Selected & Unselected. The text box tells what kind of the state change is made by the user while he/she clicked the Two-State button last time.
Top portion of the Frame window has the AWT Choice Control. There are two Text fields in the Frame. The first one takes a string and adds it to the Choice Control via Add button click. The next text field is used to display the selected text of the Choice Control. Moreover, the Remove button click will use this text field to delete an item in the Choice.