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