JInternalFrame setDefaultCloseOperation
Hello,
I don't think the setDefaultCloseOperation works correctly.
What I want to do is when I click on the 'X' in the right corner of the
window, that it just hides. I have tried HIDE_ON_CLOSE and that doesn't
work, and I have also written my own close operations by setting
DO_NOTHING_ON_CLOSE. I just want to set JInteranalFrame
setVisible(false) so when I call setVisible(true) on it that it shows up
again.
You can see my code below.
Any sugestions?
Thanks in advanced,
Matt
public class ApplicationWindow extends JInternalFrame implements Plugin {
public ApplicationWindow() {
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
addInternalFrameListener(new InternalFrameAdapter() {
public void internalFrameClosing(InternalFrameEvent e) {
System.out.println("hiding ....");
JInternalFrame frame = (JInternalFrame)e.getSource();
frame.setVisible(false);
System.out.println("done");
}});
setFrameIcon (new ImageIcon (ClientData.instance().getImage
("computer-small.png")));
setIconifiable (true);
setClosable (true);
setResizable (true);
setVisible(false); //don't show starting off
setTitle("Applications");
}
}
Reply to: