Re: JFrame as JApplet?
- From: Thomas Weidenfeller <nobody@xxxxxxxxxxxxxxxx>
- Date: Mon, 27 Jun 2005 13:38:26 +0200
polsa wrote:
I was wondering if there is any way to write an application which can be run as well as a JFrame as as a JApplet. And if so: how can I figure out which way the application has been started?
If main() is called, then it was started as an application. I haven't done this in ages, but the following should start the applet when it is called as an application:
public class MyAppletStub implements AppletStub {
// implement all AppletStub methods here
public MyAppletStub(String args[]) {
// parse and remember command line
}
} public static void main(String args[]) {
JApplet a = new MyJApplet();
a.setStub(new MyAppletStub(args));
a.init();
a.start();
}There are other things which might need to be adjusted. My notes tell me that I got the above from some Sun article, but I can't find the original article at the moment.
Maybe you probably better use Sun's AppletViewer to run the applet as an application.
/Thomas
-- The comp.lang.java.gui FAQ: ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq .
- Follow-Ups:
- Re: JFrame as JApplet?
- From: Thomas Fritsch
- Re: JFrame as JApplet?
- References:
- JFrame as JApplet?
- From: polsa
- JFrame as JApplet?
- Prev by Date: Re: JFrame as JApplet?
- Next by Date: J2ME PhD Job Offer Belgium
- Previous by thread: Re: JFrame as JApplet?
- Next by thread: Re: JFrame as JApplet?
- Index(es):
Relevant Pages
|
|