Re: JFrame as JApplet?
- From: Thomas Fritsch <i.dont.like.spam@xxxxxxxxxxx>
- Date: Mon, 27 Jun 2005 15:12:04 +0200
Thomas Weidenfeller wrote:
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.
Seems that you refer to this article: http://java.sun.com/developer/technicalArticles/Programming/TurningAnApplet/
Maybe you probably better use Sun's AppletViewer to run the applet as an application.
/Thomas
-- "Thomas:Fritsch$ops:de".replace(':','.').replace('$','@')
.
- Follow-Ups:
- Re: JFrame as JApplet?
- From: Thomas Weidenfeller
- Re: JFrame as JApplet?
- References:
- JFrame as JApplet?
- From: polsa
- Re: JFrame as JApplet?
- From: Thomas Weidenfeller
- JFrame as JApplet?
- Prev by Date: J2ME PhD Job Offer Belgium
- Next by Date: Re: JFrame as JApplet?
- Previous by thread: Re: JFrame as JApplet?
- Next by thread: Re: JFrame as JApplet?
- Index(es):