当我选择JCombobox
我想在它被选中并显示下拉列表时处理事件以及在下拉列表消失并且JCombobox
取消选择时处理事件。
请注意,我不是在寻找项目选择更改,而是在用户选择JCombobox
并且 UI 弹出下拉菜单时。
当我选择JCombobox
我想在它被选中并显示下拉列表时处理事件以及在下拉列表消失并且JCombobox
取消选择时处理事件。
请注意,我不是在寻找项目选择更改,而是在用户选择JCombobox
并且 UI 弹出下拉菜单时。
您想使用addPopupMenuListener,它使用以下接口:
public interface PopupMenuListener extends EventListener {
/**
* This method is called before the popup menu becomes visible
*/
void popupMenuWillBecomeVisible(PopupMenuEvent e);
/**
* This method is called before the popup menu becomes invisible
* Note that a JPopupMenu can become invisible any time
*/
void popupMenuWillBecomeInvisible(PopupMenuEvent e);
/**
* This method is called when the popup menu is canceled
*/
void popupMenuCanceled(PopupMenuEvent e);
}