This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Why are my JFrames closing? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Why are my JFrames closing?" Watch "Why are my JFrames closing?" New topic
Author

Why are my JFrames closing?

Shanna Ripley
Greenhorn

Joined: Mar 12, 2010
Posts: 18
Hi All

I'm trying to create my own instant messenger and have come across a problem. I have a log in form, when the user enters their name. Once they click 'Log In', another window opens displaying the users that are currently online. My problem arises when I want to close the log in form. When I close this the other window that displays the online users also closes. Does anyone know why this happens??

Thanks in advance.




pete stein
Bartender

Joined: Feb 23, 2007
Posts: 1561
What do you think the indicated line does?



Having said this, I'll also say that perhaps the login window ought to be a dialog and not a JFrame. Then this would be a moot issue.

Much luck!
Thiagu Sin
Greenhorn

Joined: Jan 10, 2009
Posts: 13
Why not you try DISPOSE_ON_CLOSE or HIDE_ON_CLOSE because EXIT_ON_CLOSE calls Syste.exit(0) and exits the whole application. Dispose_on_close will only close the whole program when there are no active threads running and Hide_on_close will just hide your log-in window. Like what pete stein said why not try JDialog, its more relevant for the current situation.

http://java.sun.com/docs/books/tutorial/uiswing/components/frame.html



Regards,
-Thiagu-
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why are my JFrames closing?