Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / December 2003

Tip: Looking for answers? Try searching our database.

Problem with editable JComboBox

Thread view: 
Erik Braun - 28 Dec 2003 21:44 GMT
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?

thank you,
Erik
Chris Shepherd - 29 Dec 2003 00:22 GMT
> 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
[quoted text clipped - 4 lines]
> 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.

Signature

Chris Shepherd



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.