Re: Problem with editable JComboBox

From: Chris Shepherd (chshNOSPAM_at_cogeco.ca)
Date: 12/29/03


Date: Sun, 28 Dec 2003 19:22:58 -0500

Erik Braun wrote:
> If I use 2 editable JComboBoxes, the action command when typing
> in some value in the editable part of the JComboBox for both of the
> JComboBoxes is "comboBoxEdited":
> ((JComboBox) actionevent.getSource()).getActionCommand()
>
> Changing the action command with setActionCommand() does not
> change this.
> How can I determine which JComboBox was changed?

You can do this by comparing the object that getSource() returns to your
existing JComboBox object definition. Do something along the lines of:

if (actionevent.getSource().equals(cOne)) {
   // etc
}

Where cOne represents the first combo box object.

-- 
Chris Shepherd