How can I diplay and Applet on a swing application?
Joined: Jul 05, 2002
I found myself in a quiet unusual situation. I need to display an applet on a JPanel. But can't seem to figure out how to go about it, or it would be possible at all. I kind of think this should be possible since Applet is a subclass of Panel.
I'm would like to display the Applet on a JPanel, which is part of a JTabbedPane and I don't know how I can go about doing so. I attempted trying to take swing components ability to display HTML a little futher but it didn't work. Since something like this is possible:
I created a Panel and made it contain only one label , which would be displayed when the appropriate tab is clicked. Now the label contained HTML but with the applet tag. [Dont laugh!. Didn't know what else to do. ]
But then at runtime, I got all the exceptions:
This is making me to think that my solution lies in the javax.swing.text.html, and the javax.swing.text packages. If this is so, is anyone familiar with these packages, or does anyone have any idea how I could achieve what I want to achieve?
Any useful suggestions would be appreciated.
Thanks so much.
Joined: Jan 14, 2004
If your applet is an AWT applet it won't work. If it's a JApplet okay. Here's one way to do it.