Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Delay in displying contents of JDialog

 
Yohan Weerasinghe
Ranch Hand
Posts: 507
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 507
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Micheal!! It really worked! Thank you!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic