Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/390.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/multithreading/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何制作GUI主线程&x27;等等';直到一个单独的弹出窗口消失_Java_Multithreading_Swing_User Interface_Awt - Fatal编程技术网

Java 如何制作GUI主线程&x27;等等';直到一个单独的弹出窗口消失

Java 如何制作GUI主线程&x27;等等';直到一个单独的弹出窗口消失,java,multithreading,swing,user-interface,awt,Java,Multithreading,Swing,User Interface,Awt,我有一个从主GUI线程调用的对象,它显示一个单独的JFrame数秒,然后消失(使用计时器)。现在我想让主GUI线程等待弹出的JFrame窗口消失。例如,在主GUI代码上: // initiate the object and show the pop-up JFrame DisappearingJFrame djf = new DisappearingJFrame (); djf.show (); // now the main GUI thread should wait // and af

我有一个从主GUI线程调用的对象,它显示一个单独的JFrame数秒,然后消失(使用计时器)。现在我想让主GUI线程等待弹出的JFrame窗口消失。例如,在主GUI代码上:

// initiate the object and show the pop-up JFrame
DisappearingJFrame djf = new DisappearingJFrame ();
djf.show ();

// now the main GUI thread should wait
// and after the pop-up JFrame disappears, the rest of the code is then executed
...
...

欢迎提出任何建议。谢谢。

不要使用单独的JFrame,因为这是构建模态对话框的目的。使用JOptionPane或模态JDialog。

不要使用单独的JFrame,因为这是模态对话框的构建目的。使用JOptionPane或模态JDialog

我有一个从主GUI线程调用的对象,它显示了一个单独的JFrame

如果你想展示不止一个,也许最好找一个,因为有了它你可以玩&

方法
show()
是否已被弃用并替换为方法

我有一个从主GUI线程调用的对象,它显示了一个单独的JFrame

如果你想展示不止一个,也许最好找一个,因为有了它你可以玩&


方法
show()
不是已经弃用并被方法取代了吗?

如果弹出的
JFrame
并不复杂,为什么不在主窗口顶部使用模式
JDialog
呢?你的意思是制作一个定制的JDialog,带有计时器,在几秒钟后就会消失?是的。虽然我不知道asgs的意思是“不复杂”。即使JFrame很复杂也要这样做。另请参见此。如果弹出的
JFrame
不复杂,为什么不在主窗口顶部使用模态
JDialog
?您的意思是制作一个定制的JDialog,带有计时器,几秒钟后就会消失?是的。虽然我不知道asgs的意思是“不复杂”。即使JFrame很复杂,也要这样做。