File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Applets and the fly likes launch Applet from another program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "launch Applet from another program" Watch "launch Applet from another program" New topic
Author

launch Applet from another program

sudipto shekhar
Ranch Hand

Joined: Apr 02, 2008
Posts: 823

I want to start an applet "MyApplet" from one of my application.

How do I do that?

Please Help.


Regards, Sud.
SCJP 5 ScjpFAQ JLS
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41621
    
  55
What do you mean by "start"? In a browser? In appletviewer? In a window of your -desktop?- application? Something else?


Ping & DNS - my free Android networking tools app
sudipto shekhar
Ranch Hand

Joined: Apr 02, 2008
Posts: 823

thnx for the reply.

I want to start it in an appletviewer or a window
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41621
    
  55
If you have an HTML file that contains the applet tag, you can start appletviewer using Runtime.exec or the ProcessBuilder class. The HTML file would be a parameter on the command line (just like you'd run appletviewer normally).

If you want it to be part of your application, you can the class that extends applet to a Frame (of JFrame), since Applet extends Panel. Call init(), and then start() and stop() as appropriate. Be aware that you lose some applet features when doing it like this (namely, parameters and the applet context).
sudipto shekhar
Ranch Hand

Joined: Apr 02, 2008
Posts: 823

thank you.that was great and very clear.
sudipto shekhar
Ranch Hand

Joined: Apr 02, 2008
Posts: 823

An example would help,please.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41621
    
  55
An example of what? I mentioned several ways; which one are you pursuing? What do you have so far?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: launch Applet from another program