File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Delay in displying contents of JDialog Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Delay in displying contents of JDialog" Watch "Delay in displying contents of JDialog" New topic
Author

Delay in displying contents of JDialog

Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

Please have a look at the following code



This is a email program. Here, the class "ProgressMonitor" is a JDialog which is showing the text "Sending..Please wait..." when the email is being sent, and disappears when the email is sent. But in here, the JDialog appears blank!When the email is sent, it shows the JLabel! Why is that? I have tried using SwingUtilities.InvokeLater() too, but in that case, the the blank window also wasn't shown when the email is sending. I know this is a code with number of lines, but the issue is in lines 172-203. I decided to put this whole code because removing code eliminates the issue sometimes, and you won't be able to test if you need. Please help!


Are you better than me? Then please show me my mistakes..
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
the SendEmail bit sounds like it is blocking Swing's EDT from painting, so needs to be in a separate thread or SwingWorker.


would go something like this (rough, and will need tweaking)

Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

Thanks a lot Micheal!! It really worked! Thank you!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Delay in displying contents of JDialog