• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to handle Modal Frame and Runnable thread simultaneously

 
R.Joe
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 690
Eclipse IDE Firefox Browser Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic