I have this code:
public String readInputFile(String text) {
JOptionPane.showMessageDialog(new JFrame(), text);
// add stuff later here...
return text;
}
But when I run it from eclipse it never terminates (the red button never goes gray). But if I do:
public String readInputFile(String text) {
JFrame jFrame = new JFrame();
JOptionPane.showMessageDialog(jFrame, text);
// add stuff later here...
jFrame.dispose();
return text;
}
it terminates nicely. But is it necessary to declare the JFrame as a local variable and call dispose to make this work?