Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show JDialog ("Please Wait") on JFrame

I have a JFrame and this JFrame has a JButton.

I want in JButton first show JDialog (display "Please wait") and execute other code then closing JDialog.

But when showing JDialog stopped to execute other code on JButton.

like image 983
or123456 Avatar asked Jan 08 '12 07:01

or123456


1 Answers

Start the other processing on a Thread (e.g. in a SwingWorker) and at the start of it, call modalDialog.setVisible(true). At the end of the task call setVisible(false).

like image 71
Andrew Thompson Avatar answered Oct 04 '22 22:10

Andrew Thompson