|
Replies:
4
-
Last Post:
Jun 10, 2008 12:00 AM
by: Kleopatra
|
|
|
|
|
|
|
What's the proper way to close a window
Posted:
Jun 8, 2008 6:55 AM
|
|
|
I know this is just about as rudimentary as it gets, what is the proper way to close a window, such as a custom dialog. It seems like all of the examples in the Swing Tutorial exit on close.
My specific need is to capture the values from the input fields on a dialog when the user presses the OK button, then close the window. The only other examples I've seen are setVisible(true). Is that the correct way?
To put it another way, assuming the application is done with the window, how should it be closed while the application remains running?
Thanks.
Message was edited by: jimgood
|
|
|
|
|
|
|
Re: What's the proper way to close a window
Posted:
Jun 8, 2008 8:19 AM
in response to: jimgood
|
|
|
If you're interested in keeping the dialog around for future use, you can just call setVisible(false) on the dialog. Then when you need the dialog again, just call setVisible(true).
If you want to get release resources you can call dispose().
|
|
|
|
|
|
|
|
Re: What's the proper way to close a window
Posted:
Jun 8, 2008 8:28 AM
in response to: idawes
|
|
|
Oh yeah... forgot to mention that if your input is particularly simple, you don't need to make your own dialog, you can just use the show????Dialog methods from JOptionPane. They take care of lots of stuff for you, and make things look standard.
|
|
|
|
|
|
|
|
Re: What's the proper way to close a window
Posted:
Jun 9, 2008 5:00 AM
in response to: idawes
|
|
|
Thanks. I think dispose() is what I was looking for.
|
|
|
|
|
|
|
|
Re: What's the proper way to close a window
Posted:
Jun 10, 2008 12:00 AM
in response to: jimgood
|
|
|
jdnc-interest@javadesktop.org schrieb: > I know this is just about as rudimentary as it gets, what is the proper way to close a window, such as a custom dialog. It seems like all of the examples in the Swing Tutorial exit on close. > > >
sooo ... why did you post in this forum which is highly focused on SwingLabs related questions? Usually, you'll be better off in a more general group/forum.
Jeanette
PS: yeah, I'm back again - reading my way through the piled-up heap of everything and starting the easy way with one of my standards <g>
--------------------------------------------------------------------- To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net For additional commands, e-mail: jdnc-help@jdnc.dev.java.net
|
|
|
|
|