This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Possible to use applet from swing app? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Possible to use applet from swing app?" Watch "Possible to use applet from swing app?" New topic
Author

Possible to use applet from swing app?

Fon Drank
Greenhorn

Joined: Feb 20, 2007
Posts: 14
Is it possible to open and use a java applet from a desktop swing application?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41020
    
  43
What would be the point of that? Instead of making it an applet (by extending JApplet), make it a window (by extending JFrame), and you're mostly done.

Or is it someone else's applet that you don't have code for? You can always open a web page that refers to the applet; the last item on this FAQ page tells you how.


Ping & DNS - my free Android networking tools app
Timothy Wall
Greenhorn

Joined: Sep 14, 2002
Posts: 14
You can always create the applet yourself and set its AppletContext to a small stub implementation, then call the init() and start() methods. You can also call JApplet.getContentPane() and reinstall that component in a JFrame's content pane, assuming the applet doesn't assume too much about its environment.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41020
    
  43
You can always create the applet yourself and set its AppletContext to a small stub implementation, then call the init() and start() methods.

The MainFrame class already does most of that, if you want to go down that road.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Possible to use applet from swing app?
 
Similar Threads
Scripting a "Swing applets" used for Client-Server communication?
Capturing applet from other source
applet in tabbedpane
can we use Swing Component in JSP page
applet in frame