I have a program with a lot of MouseListeners. The issue I am having is the program is ending even before I click. I tried using sleep and flags to pause the program without much success. Just wondering if there is way to get the program to pause, go through all the MouseListeners and then resume the program. Will invokeLater() work here? If yes, could you give me a simple illustration of how it works?