+ 11

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.

12th Jun 2019, 1:36 PM
Seniru
Seniru - avatar
2 ответов
+ 3
Belal Al-Qudah I think I have forgotten to mention this. The code below the popup invokes before the picker pops out
13th Jun 2019, 1:09 PM
Seniru
Seniru - avatar
+ 2
after you submit you can wait() or sleep() . look into those functions . use them with while statement like while( finishTarnsmit()==false) (new thread).sleep(100)
13th Jun 2019, 12:52 AM
Belal Al-Qudah
Belal Al-Qudah - avatar