Hi All
I've got a JInternalFrame (intFrame) with this:-
intFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
I've added a: - intFrame.addInternalFrameListener(this);
Within 'this' I've got: -
public void internalFrameClosing(InternalFrameEvent e) {
int i = JOptionPane.showInternalConfirmDialog(intFrame,
"Do you really wish to Close?",
"Message",
JOptionPane.YES_NO_OPTION,
JOptionPane.INFORMATION_MESSAGE);
//The user must decide weather or not to dispose the JInternalFrame
if( i == JOptionPane.NO_OPTION )
listenedToWindow.show(); //An effort to prevent it from closing
}
This does not work. I cannot prevent the JInternalFrame from closing.
I tried overwriting the dispose() method but an exception is thrown saying that intFrame is an invalid parent for JOptionPane.showInternalConfirmDialog(....)
Therefore I conclude that setting the default close operation to dispose does not simply cause a call to method dispose() when the close icon is pressed on the JInternalFrame as I expected.
My Question is this. How can I prevent the JInternalFrame from closing. I wish it to dispose not hide when the user decides to actually close it.
Thanks.