In my code i generate some images and display them every image in a jframe, but when i close on the jframes i found all the other closes as well. I want when i close one of the jframes, the others remain.
how can i do that.
code:
private static void initJFrame(String caption) { // TODO Auto-generated method stub if (caption.isEmpty() || caption.equals("")) { caption = SysConsts.DEFAULT_JFRAME_CAPTION; } JFrame mediaFrame = new JFrame(caption); mediaFrame .setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); mediaFrame.setSize(SysConsts.DEFAULT_JFRAME_WIDTH, SysConsts.DEFAULT_JFRAME_HEIGHT); facePanel = new FacePanel(); mediaFrame.setContentPane(facePanel); mediaFrame.setVisible(true); mediaFrame.validate(); } @Hovercraft Full Of Eels: your suggestion does not answer my question *
JFrame.EXIT_ON_CLOSEthe program exits, so obviously the other frames are closed as well. If you insist on using multiple frames you need to track them yourself, and only exit when the last frame is closed.