Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to bring user back to the internalframe after JOptionPane?

 
Yingie Pitts
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic