Re: opening a window from an applet..



Frances wrote:
when you open a window from an applet (I mean JApplet) does that window also have to be an applet? if not then what? JFrame? (public class [class] extends JFrame?) if it's a JFrame instead of an applet does it still have to have init() method? or does it have to have main() method instead? I'm confused about this... can u pls point to where I can read up on this in java.sun.. (a lot of things they explain about applets is very different for JApplets.. and sometimes when they're explaining something about applets I don't know if what they're talking about also applies to JApplets..)
(can I open a swing window from an applet? or does it have to be from a JApplet?)

You have a few choices:

o Open a new browser window with AppletContext.showDocument (which might or might not work). In that case you would have a another applet embedded in the HTML page.

o Open a Frame/JFrame. Which is a frame like any other. Because you have a security manager installed, it'll have a little banner to notify the user that it is not to be trusted. There is no init or main methods in JFrame, and there doesn't need to be. Just create it and call setVisible(true) on it (from the Event Dispatch Thread). You don't even need to extend JFrame except in specialist cases. A problem with this is that you don't know where that applet is and nor do you have much control over z-order.

 o Use JInternalFrames to create an MDI within the applet.

Tom Hawtin
.



Relevant Pages

  • Re: opening a window from an applet..
    ... (public class extends JFrame?) ... if it's a JFrame instead of an applet does it still have to have initmethod? ... (can I open a swing window from an applet? ... Which is a frame like any other. ...
    (comp.lang.java.gui)
  • Re: opening a window from an applet..
    ... (public class extends JFrame?) ... if it's a JFrame instead of an applet does it still have to have initmethod? ... (can I open a swing window from an applet? ... public void init() { ...
    (comp.lang.java.gui)
  • JFrame Status Abfrage ( isShowing or NOT ???)
    ... Wenn ich nun in dem Applet auf einen ... Button klicke oeffnet sich eine JFrame. ... Moeglich mit OK zu bestaetigen und zu speichern oder mit Cancel ... Ich habe es im Applet mit einer while Schleife versucht und ...
    (de.comp.lang.java)
  • Re: opening a window from an applet..
    ... (public class extends JFrame?) ... if it's a JFrame instead of an applet does it still have to have initmethod? ... (can I open a swing window from an applet? ... a new window from an applet this is simply for a chat app applet, chat window opens in a new window (new window doesn't mean a separate app.. ...
    (comp.lang.java.gui)
  • Re: applets call comportement
    ... the mechanism by which Java's dynamic linking behavior ... > reimplementation of JFrame (i.e. it cannot extend the system's JFrame ... > accomplish your aim might be for your application to use a custom AWT ... I'm just wondering, when an applet call the JFrame class for example, there ...
    (comp.lang.java.programmer)