parent JFrame can kill the child (JDialog)?

Hi,

-

|One toggle button

|

|_

JFrame has one toggle button.

When user press the toggle button, JDialog popups,

and (what I want to do is) when user press the toggle again,

JDialog killed. not just setvisible (false) ==> which goes behind the

JFrame.

How do I do that? Let me know asap. Thanks -

Message was edited by:

PaulSheldonII_Screen

Message was edited by:

PaulSheldonII_Screen

[483 byte] By [PaulSheldonII_Screena] at [2007-10-3 3:01:15]
# 1
Did you try the dispose() method ?
franck_rf1a at 2007-7-14 20:50:56 > top of Java-index,Desktop,Core GUI APIs...
# 2
yes, I did try aJDialog.dispose();even, aJDialog = null; not only,aJDialog.setVisible(false); But, it still alive behind the JFrame.
PaulSheldonII_Screena at 2007-7-14 20:50:56 > top of Java-index,Desktop,Core GUI APIs...
# 3

dispose() should work.

If you need further help then you need to create a [url http://homepage1.nifty.com/algafield/sscce.html]Short, Self Contained, Compilable and Executable, Example Program[/url] that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.

And don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags[/url] so the code retains its original formatting.

camickra at 2007-7-14 20:50:56 > top of Java-index,Desktop,Core GUI APIs...
# 4
When running a modal dialog any GUI events for other components are discarded, i.e. the toggle button on the main JFrame will be dead.So you can only do it by not making your dialog modal.
malcolmmca at 2007-7-14 20:50:56 > top of Java-index,Desktop,Core GUI APIs...
# 5

Thanks, camickr

But, your answer has been identical without any sinlge

letter different from before the question I asked previously.

You have no obligation to answer it if you don't want to,

instead of copying the answer you made identical cut and paste,

not only me but also any other posting.

But, thanks for your persistent guidance when there is

no obligation to answer.

PaulSheldonII_Screena at 2007-7-14 20:50:56 > top of Java-index,Desktop,Core GUI APIs...