jQuery in Action, 2nd edition*
The moose likes Beginning Java and the fly likes  ClassCastException: sun.plugin.viewer.frame.IExplorerEmbeddedFrame to ViewerFrame Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark " ClassCastException: sun.plugin.viewer.frame.IExplorerEmbeddedFrame to ViewerFrame" Watch " ClassCastException: sun.plugin.viewer.frame.IExplorerEmbeddedFrame to ViewerFrame" New topic
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: 19653
    
  18

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 - OCEEJBD 6
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: 19653
    
  18

You're welcome.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ClassCastException: sun.plugin.viewer.frame.IExplorerEmbeddedFrame to ViewerFrame
 
Similar Threads
Establish LDAP Connection from within Swing
Applet & Application Reference
Need help converting complex Swing App to Applet
sorting a Vector
Need help converting complex Swing App to Applet