Given the following applet:
import java.awt.BorderLayout; import java.awt.Rectangle; import java.lang.reflect.InvocationTargetException; import javax.swing.JApplet; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; public class Example extends JApplet { JPanel aPanel; @Override public void init() { try { javax.swing.SwingUtilities.invokeAndWait(new Runnable() { public void run() { makeGui(); } }); } catch (InterruptedException e) {
Why does calling JOptionPane close aTestFrame? If I omit the call, then 2 frames display correctly, but when I click "OK" in JOptionPane, the parent JFrame closes.
The first answer is correct, apparently, there is a problem with focus. THANKS!
Reene source share