I have written an applet that is a bit too large to fit comfortably in
a Netscape 6x window, and therefore, I would like it to live in its
own 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("BigApplet");

    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 sort of thing 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 to the list.

_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing

Reply via email to