permaculture playing cards*
The moose likes Swing / AWT / SWT and the fly likes JComboBox not allowing selection from dropdown list Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JComboBox not allowing selection from dropdown list" Watch "JComboBox not allowing selection from dropdown list" New topic
Author

JComboBox not allowing selection from dropdown list

Farrukh Najmi
Greenhorn

Joined: Jan 29, 2008
Posts: 5

I have a non-editable JComboBox with some pre-configured choices via a model.
The choices display fine in dropdown menu when I click on the JComboBox.
As I move cursor over the choices they get highlighted. However, when I click on a
choice they do not get selected and instead I see the default item stay in the combobox.

What could be the reason why I cannot select from drop down list in my JComboBox?

Note that I am not including any code as my JComboBoxsub-class and its model are fairly
complex.

Thanks for any help.


--Farrukh
Farrukh Najmi
Greenhorn

Joined: Jan 29, 2008
Posts: 5
SOLVED

I determined the cause of the problem. In my JComboBox sub-class I was incorrectly overriding the setSelectedItem(Object) method and not calling super.setSelectedItem(Object) when I should have been.

Thanks.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: JComboBox not allowing selection from dropdown list
 
Similar Threads
getting values into the drop down list from database
How to retain selected content after post on same page
Problem in Reset button.
populate JComboBox and MVC
Editable JComboBox w. JDialogBox