• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ClassCastException: sun.plugin.viewer.frame.IExplorerEmbeddedFrame to ViewerFrame

 
Mohiuddin Russel
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When i am going to run my swing application as a applet, it shows an error ClassCastException: sun.plugin.viewer.frame.IExplorerEmbeddedFrame to ViewerFrame. ViewerFrame is a class that is inherited from JFrame. If i run it as a standalone swing application then it runs well. After some debugging i found that when the program run as an applet in the browser, viewer class name changes to IExplorerEmbeddedFrame. Please help me what i have to do? Thanks in advance.
 
Matt Cartwright
Ranch Hand
Posts: 152
Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy Mohiuddin and welcome to the Ranch

when you say

going to run my swing application as a applet


does that mean you are using the appletviewer?

If that is a yes, your code should be something like:



Hope that helps
Matt
 
Rob Spoor
Sheriff
Pie
Posts: 20611
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Applets don't use user implemented frames. Instead there is a Frame (not JFrame!) representation of the browser window. The applet is added to this frame.

To run a Swing application as an applet, you need to do the following:
- take away all logic from the frame class, and put it in one (or more) other class(es).
- the frame just adds all components from that (those) other class(es).
- the applet does the same

A very brief:
 
Mohiuddin Russel
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank You very much for your help.

It works now.
 
Rob Spoor
Sheriff
Pie
Posts: 20611
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic