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 how to enforce the user to close the frame before proceed to another frame? 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 "how to enforce the user to close the frame before proceed to another frame?" Watch "how to enforce the user to close the frame before proceed to another frame?" New topic
Author

how to enforce the user to close the frame before proceed to another frame?

kahkean chor
Ranch Hand

Joined: Jan 26, 2013
Posts: 56
something like this........thanks in advance


[Thumbnail for Untitled.jpg]

Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2204
    
    7
In general an application should only use a single main JFrame. For other popup windows you should use a JDialog. In this case you would want to use a model JDialog which will force the user to close the dialog before continuing.
kahkean chor
Ranch Hand

Joined: Jan 26, 2013
Posts: 56
sry..i dun get it....can write down some sample code?
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2204
    
    7
You create JDialogs the same way you create a JFrame.

Or in your case you may be able to use a JOptionPane which creates the JDialog for you.

Start by reading the Swing tutorial on: How to Make Dialogs
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: how to enforce the user to close the frame before proceed to another frame?