*
The moose likes Swing / AWT / SWT and the fly likes How to bring user back to the internalframe after JOptionPane? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to bring user back to the internalframe after JOptionPane?" Watch "How to bring user back to the internalframe after JOptionPane?" New topic
Author

How to bring user back to the internalframe after JOptionPane?

Yingie Pitts
Ranch Hand

Joined: Oct 10, 2002
Posts: 37
I added the following JOptionPane into my InternalFrame (this):
JOptionPane.showConfirmDialog(this, "Are you sure?", "title", JOptionPane_OK_CANCEL_OPTION);
After I chose Ok or Cancel button, not only the JOptionPane was closed, but also the InternalFrame. How can I just close the JOptionPane and return to the InternalFrame?


"To err is human, but to really foul things up you need a computer." Paul Ehrlich.
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

I'm assuming you're doing this in the internalFrameClosing() method of an InternalFrameListener...

That means the internal frame is already closing, you can pop up the option pane in response, but you can't do anything to stop it. You'll need to setDefaultCloseOperation() of the internal frame to DO_NOTHING_ON_CLOSE and dispose of the internal frame only if the user selects 'YES' in the option pane.


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to bring user back to the internalframe after JOptionPane?
 
Similar Threads
JInternalFrame vs JDialog
Custome generated alert message
Constructing modified JOptionPane
Making JOptionPane disappear after Ok is pressed
Applet with Theme does not refresh properly