aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes How to handle Modal Frame and Runnable thread simultaneously Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to handle Modal Frame and Runnable thread simultaneously" Watch "How to handle Modal Frame and Runnable thread simultaneously" New topic
Author

How to handle Modal Frame and Runnable thread simultaneously

R.Joe
Ranch Hand

Joined: Jun 16, 2004
Posts: 31
I am sending the request to the server, till the response comes modal dialog box appears as soon as response comes it update the jtable and close the dialog box

Runnable run = new runnable()
{
public void run()
{
// req send to server and after receiving the response, it update into the table
//modal dialog box dispose
}

};
SwingUtilities.invokeLater(run);
//modal dialog box appears

Pl help me out
Kaydell Leavitt
Ranch Hand

Joined: Nov 18, 2006
Posts: 689

I believe that a Runnable that is started with invokeLater() or invokeAndWait() doesn't start a new Thread, but tells the one-and-only Swing/AWT thread to call run() -- and doesn't call start().

Will somebody correct me if I am mistaken?
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
You could make up a splash screen using a JWindow, add message to user and possibly a
JProgressBar or JProgressMonitor. Show it just before you start your background thread for
the other work.
A modal dialog has controls that the user can use to dismiss it. Using a JWindow would
avoid the difficulties with this. For the modal part you could disable/enable the JFrame
as you show/dispose the JWindow.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to handle Modal Frame and Runnable thread simultaneously