wood burning stoves 2.0*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes about the JComboBox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "about the JComboBox" Watch "about the JComboBox" New topic
Author

about the JComboBox

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi,
I'm using 3 JComboBoxs to let user select origin,destination and carrier. but i just can't use it's getSource() to identify which comboBox is selected. any idea...
Thanks in advance,
lili
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi li li,

I'm using 3 JComboBoxs to let user select origin,destination and carrier. but i just can't use it's getSource() to identify which comboBox is selected. any idea...

How do you initiate the search? Are you trying to build the criteria "on the fly", ie while the combo box has the focus? I had a search button, and built the criteria after the button was pressed by getting the selected item from each combo box. The three combo boxes and the search button were all members of a class which extended JPanel so it was real simple to build the criteria in the actionPerformed of the button.
Hope this helps,
Michael Morris


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Sarita Gupta
Ranch Hand

Joined: Aug 12, 2002
Posts: 43
Hi Li Li,
I would agree with Michael, I did the same... simply click a btn to initiate a search
Sarita


There are no great people in this world, only great challenges which ordinary people rise to meet.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: about the JComboBox
 
Similar Threads
how to add dropdownlistbox to text field
Combo box selection
JSlider works but doesn't "slide"
how to change the selected value in the jComboBox ,when selecting another jcombobox having same name
problem in JComboBox