Java JComboBox Drop Down event
Is it possible to determine开发者_开发技巧 when a user clicks on a JComboBox to drop down the list of items in it? I just want to capture this event, not when an item is selected from the list.
Many thanks,
Andez
You can use JComboxBox#addPopupMenuListener(PopupMenuListener listener)
You can use a PopupMenuListener to determine when the drop down is about to open. Add it using the: addPopupMenuListener-Method.
http://download.oracle.com/javase/6/docs/api/javax/swing/event/PopupMenuListener.html
Use this method
void popupMenuWillBecomeVisible(PopupMenuEvent e)
It is possible with method JComboBox.addPopupMenuListener(PopupMenuListener l)
.
精彩评论