Timer or other idea required to allow code to continue execution after calling method and JOptionPane

后端 未结 3 1445
[愿得一人]
[愿得一人] 2020-12-04 02:58

I need a way to allow my program to keep running code after this method is called.

Currently, it waits for half an hour, gets the info, stores it to the object WeatherCar

3条回答
  •  不思量自难忘°
    2020-12-04 03:45

    But it hangs on the JOptionPane. I need a way to make it so that the program either keeps going underneath the JOptionPane or to close the pane after about 10 seconds. I am not sure how to work either into my code, currently

    there are two ways

    • (better easier, comfortable) create JDialog(JFrame parent, boolean true), with default close operation HIDE_ON_CLOSE, only one JDialog as local variable, reuse this Object by setVisible(false/true)

    • looping inside arrays of all JOptionPanes (all exists there untill current JVM is alive) by @kleopatra

提交回复
热议问题