File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can I diplay and Applet on a swing application?

 
Femi Alla
Ranch Hand
Posts: 79
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greetings everyone,

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. ]

Here:



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.
 
Craig Wood
Ranch Hand
Posts: 1535
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your applet is an AWT applet it won't work. If it's a JApplet okay. Here's one way to do it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic