2014-12-07 14 views
0

我搜查了網絡,找不到能幫助我的具體事情。我有我的Swing Worker類在後臺做一些工作,而這種情況正在發生,我想禁用我的用戶界面上的所有內容。擺盪者工作時禁用所有東西?

我不想從一個按鈕到下一個(Jlist,Jtable)等,並禁用一切。有更容易的方法嗎;像在我的UI上繪製一些東西,然後在Swing Worker完成時將其刪除?有人可以告訴我如何做這樣的事情。或者你會有什麼建議。

我已經知道如何在Swing Worker完成時獲得通知。只是尋找停止一切的最佳方式。

+1

怎麼樣[這](http://stackoverflow.com/questions/19324918/how-to-disable-all-components-in-a-jpanel/19328368#19328368)或[this](http://stackoverflow.com/questions/12169662/how-would-i-disable-a-text-box/12169692#12169692)或[this](http:// stackoverflow .com/questions/20799814/how-to-disable-enable-jframe-component-when-jinternalframe-isvisible-inside-jfra/20813257)或[this](http://stackoverflow.com/questions/19799451/的java阻擋焦點從 - 的JComponent/19801009#19801009) – MadProgrammer 2014-12-07 23:21:02

回答

0

最好的辦法是以遞歸的方式解析你的JFrame.getChildren()。

但你也可以使用一個GlassPane-看到Root Panes