Updating list of jComboBox with a JTextField and JButton
Hi
I have an uneditable jCombobox
When I select an item listed on the combobox, the system prints out the name of the item chosen :
jComboBox1.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
input=(String) jComboBox1.getSelectedItem();
System.out.println("Input"+input);
}
});
I would like to update the list of item by entering an item name in a text field and clicking on a JButton.
Typically :
void jAddButton_mouseClicked(MouseEvent e) {
jComboBox1.removeAllItems();
// followed by code re-adding items to combobox
System.out.println("jcombobox updated");
}
However, whenever I click on the "Add" Button, I would like to avoid having the system printing out the name of the "Input". This happens because I modify the Combo box and therefore the action listener fires ...
What is the trick ?
Thanks for your help.

