[英]How to make the main GUI thread 'wait' until a separate pop-up window is disappeared
我有一個從主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。
我有一個從主GUI線程調用的對象,並顯示了一個單獨的JFrame
如果要顯示多個TopLayoutContainer ,最好查找JDialog,因為這樣您就可以使用ModalityType & toFront()了 。
方法show()
已被方法JDialog.setVisible(boolean)取代並被取代嗎?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.