正如标题所说,我需要知道是否有人在使用组合框。即当盒子被放下时。
有什么方法可以得到这个吗?也许是动作监听器?
使用JComboBox#addPopupMenuListener()
:
comboBox.addPopupMenuListener(new PopupMenuListener()
{
@Override
public void popupMenuWillBecomeVisible(PopupMenuEvent e)
{
// ...
}
@Override
public void popupMenuWillBecomeInvisible(PopupMenuEvent e)
{
// ...
}
@Override
public void popupMenuCanceled(PopupMenuEvent e)
{
// ...
}
});