I would like to avoid run code in popupListener before already running code in before executed popupListener. When popUplistener finish working than user can execute next popUplistener. My example unfortunately doesn't prevent about this situation. Anyone can help? I will great full for help.

UPDATE: FOLLOW (maris) RESLOVE PROBLEM:

@Override

public void popupMenuWillBecomeVisible(PopupMenuEvent event) {

JComboBox comboBox = (JComboBox) event.getSource();

comboBox.removePopupMenuListener(this);

// some code ....

// now Listener is disabled and user cant execute next listener until this listener not stop working

comboBox.addPopupMenuListener(this); // after some code we add again listener, user now can use again listener

}

网友答案:

In general to avoid duplicate event firing during the process of event handling we can follow the below steps:

Add Event listener with widget

Once an event is fired, remove the event listener at the begging of the event handling