| Author |
ClassCastException: sun.plugin.viewer.frame.IExplorerEmbeddedFrame to ViewerFrame
|
Mohiuddin Russel
Greenhorn
Joined: Mar 13, 2010
Posts: 3
|
|
|
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
Joined: Aug 25, 2008
Posts: 149
|
|
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
Joined: Oct 27, 2005
Posts: 19232
|
|
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:
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Mohiuddin Russel
Greenhorn
Joined: Mar 13, 2010
Posts: 3
|
|
Thank You very much for your help.
It works now.
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19232
|
|
|
You're welcome.
|
 |
 |
|
|
subject: ClassCastException: sun.plugin.viewer.frame.IExplorerEmbeddedFrame to ViewerFrame
|
|
|