Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JPanel like JDialog

 
alejandro garcia
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, in this code suppose that the dlg is defined in one case as a JDialog, I run it and it seems that the JDialog is executed AFTER closing it, so the message is printed after closing the JDialog.
But when I run the code with dlg defined as JPanel it prints the message before I close the JPanel.

And I need the JPanel to behave like the JDialog in that sense.. how could I deal with this?
Thanks in advance




 
Tony Docherty
Bartender
Pie
Posts: 2878
59
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I run it and it seems that the JDialog is executed AFTER closing it, so the message is printed after closing the JDialog.
I would imagine that what is happening is your JDialog is modal so it is effectively blocking the current thread when it is displayed. Once you close the dialog the method's execution continues so prints out "I'm Here".

I don't understand what you mean by closing a panel because you can't close a JPanel in the same way as a JDialog or JFrame, how are you closing it?

BTW Before attempting to perform your own block be careful because if you just block the event thread your GUI will lock up.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic