What kind of code do I have to update so that the About dialog allows me to select items within the main panel, since the following code seems to enable a modal dialog anyway?
On line 84 you're passing true to the super constructor, indicating the dialog will be modal. If you turn that into false it will no longer be modal. It will remain in front of your frame but that's how dialogs work.
Greg Brannon wrote:Why are you using Runnable() in your main() method?
Because all GUI related code should run on the EDT, and using a Runnable with EventQueue.invokeLater will cause the code of the Runnable to run on the EDT.
Rob Spoor wrote:On line 84 you're passing true to the super constructor, indicating the dialog will be modal. If you turn that into false it will no longer be modal. It will remain in front of your frame but that's how dialogs work.
Greg Brannon wrote:Why are you using Runnable() in your main() method?
Because all GUI related code should run on the EDT, and using a Runnable with EventQueue.invokeLater will cause the code of the Runnable to run on the EDT.
What does EDT stand for?
Hence, the dialog will be popped up and not leave the user any other choice than to close the dialog by selecting OK.
Greg Brannon
Bartender
Joined: Oct 24, 2010
Posts: 530
posted
1
EDT = Event Dispatching Thread.
Rob Spoor wrote:
Because all GUI related code should run on the EDT, and using a Runnable with EventQueue.invokeLater will cause the code of the Runnable to run on the EDT.
Ummmm. I've written a lot of Swing without using Runnable(). I'll have to think on that one.
Rob Camick
Ranch Hand
Joined: Jun 13, 2009
Posts: 1788
2
posted
2
I'll have to think on that one.
There is nothing to think about. That is the way it should be done.
Yes, if all you are dong is creating and showing a simple GUI it will probably work 99% of the time without using the Runnable. However, when problems appear they will be random and those are the hardest problems to solve. So play it safe and don't worry.
Read the section from the Swing tutorial on Concurrency for more information.
Greg Brannon
Bartender
Joined: Oct 24, 2010
Posts: 530
posted
0
Thinking . . . studying . . . learning, steps leading to understanding. Didn't mean to sound flippant.