*
The moose likes Applets and the fly likes WhenI try to run this applet it gives an  error??? why??need help! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "WhenI try to run this applet it gives an  error??? why??need help!" Watch "WhenI try to run this applet it gives an  error??? why??need help!" New topic
Author

WhenI try to run this applet it gives an error??? why??need help!

Ammar Salem
Ranch Hand

Joined: Dec 29, 2007
Posts: 60
here is the code

It gives a run time Error that says:
java.lang.ClassCastException: ToolbarFrame cannot be cast to java.applet.Applet
at sun.applet.AppletPanel.createApplet(AppletPanel.java:760)
at sun.applet.AppletPanel.runLoader(AppletPanel.java:689)
at sun.applet.AppletPanel.run(AppletPanel.java:361)
at java.lang.Thread.run(Thread.java:620)

looking for help
Ammar Salem
[ January 17, 2008: Message edited by: Ammar Salem ]

****************************<br />For Some Dreams.....<br />One Lifetime Is Not Enough.<br />****************************
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41106
    
  45
That's simple: this code is not an applet. The base class of an applet needs to extend java.applet.Applet, not Frame. Do you want a separate window? If so, you can create and open this class from within the applet, but if not, you can rewrite it to extend applet (e.g. by getting rid of the WindowListener, amongst other things).


Ping & DNS - my free Android networking tools app
 
 
subject: WhenI try to run this applet it gives an error??? why??need help!
 
Similar Threads
How to create 2 toolbar consecutive on a JFrame???
Accesing system clipboard in Applet
How to display toolbars like forte4java
How to fire events ?
problem in swing tool bar