How to halt a java program until a method is called successfuly?
---BACKGROUND-- I'm doing a big project at the time - it can deal with history logs of a game. In that project I created a method which returns logs within a given time - and it works very well. I decided to create a UI for that program. Also I added a button which popups a JPanel to select date ranges - there's the problem start. --PROBLEM-- The popup pops out successfuly upon a butn click and user can select the date and submit. But I have methods which evaluates after that. What the problem is that the data from the popup is not submitted properly to the main program. I just debugged to find out what was happening. Then I found that the following methods evaluates before the popup pops out. --QUESTION-- My question is how to halt the program until the user submits the dates and then again start the program. I m looking for a way like JS promises.