开发者

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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜