Saturday, 16 April 2016

java - how to close an instance of jframe

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 *

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...