This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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: 813

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: 39529
    
  27
What do you mean by "start"? In a browser? In appletviewer? In a window of your -desktop?- application? Something else?


Ping & DNS - updated with new look and Ping home screen widget
sudipto shekhar
Ranch Hand

Joined: Apr 02, 2008
Posts: 813

thnx for the reply.

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

Joined: Mar 22, 2005
Posts: 39529
    
  27
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: 813

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

Joined: Apr 02, 2008
Posts: 813

An example would help,please.
Ulf Dittmer
Marshal

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