Where can I find a good example of a JApplet that pops its own window
(instead of living within the browser's window)?

I've tried setting up the graphical contents of the applet in a
separate JFrame.  E.g.:

  public void start() {
    // parentFrame is an instance variable.
    parentFrame = new JFrame("SimpleApplet2");

    Container contentPane = parentFrame.getContentPane();

    // makeContent() returns a JPanel containing the bulk of the GUI.
    contentPane.add(makeContent());

    parentFrame.pack();
    Dimension dim = parentFrame.getToolkit().getScreenSize();
    parentFrame.setLocation(dim.width/2 - parentFrame.getWidth()/2,
                            dim.height/2 - parentFrame.getHeight()/2);
    parentFrame.setVisible(true);
  }

This works well when the applet is first loaded, but things get
variously screwed up if the applet needs to be repainted, or if the
user leaves and returns to the page controling the applet.

What's the correct way to implement an applet that lives in its own
window?

Thanks,

KJ

P.S.  Please Cc me in your replies.
_______________________________________________
Swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/swing

Reply via email to