It's not a secret anymore!
The moose likes Swing / AWT / SWT and the fly likes Drop down event in JComboBox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Drop down event in JComboBox" Watch "Drop down event in JComboBox" New topic

Drop down event in JComboBox

Jay Faluk

Joined: Apr 25, 2002
Posts: 9
Hello all.
How can I trap the drop down event on a JComboBox?
varalakshmi raj

Joined: Sep 27, 2006
Posts: 2
You can add ListSelectionListener to the JComboBox, but make sure that setPopupVisible(true).
John Davis
Ranch Hand

Joined: Nov 02, 2000
Posts: 189
I am using the Matisse GUI in the NetBeans IDE and I have a JComboBox.
When perusing the list of events associated with the JComboBox, I do not see ListSelectionListener. I need a listener to capture the setting in the JComboBox whether it be the default first item or a user selected setting.
There will be times when the user doesn't select anything in this combo box but just takes the default displayed first item, so I am leary of trying an ActionPerformed listener. I do see ComponentShown listed as an option but do not know if this maps to a ListSelectionListener. Anybody know what I should select from the Matisse event properties list for JComboBox?
I agree. Here's the link:
subject: Drop down event in JComboBox
It's not a secret anymore!