wood burning stoves 2.0*
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: 818

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: 41108
    
  45
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: 818

thnx for the reply.

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

Joined: Mar 22, 2005
Posts: 41108
    
  45
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: 818

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

Joined: Apr 02, 2008
Posts: 818

An example would help,please.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41108
    
  45
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
 
Similar Threads
Please Guide me with this
Msg from applet to browser
Applet and Servlets: Redirecting to Servlet inside an Applet
servlet applet commnication
Display a modal dialog window in an applet