Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem in adding the panel to an applet

 
smyle khanna
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i have been tryin to add the panel to an applet n its givin certain runtime exceptions,n also i have addded a counter 2 count the time which isnt workin.
the runtime exceptions are:
java.lang.ClassCastException:StartupApplet1
at sun.applet.AppletPanel.createApplet(AppletPanel.java.586)
at sun.applet.AppletPanel.runLoader(AppletPanel.java.515)
at sun.applet.AppletPanel.run(AppletPanel.java.293)
at java.lang.Thread.run(Thread.java.:484)
the program code is given below,[not completed]
plz tell me as 2 wht i have 2 use 2 make it work,
thanks in advance,
Smyle
 
Jasmine kaur
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I could not understand that your class StartupApplet1 should habe been exentded with Applet class and I have noticed that you not have done this and how are you calling this applet.
Please see your code once again.
jasmine
 
Jasmine kaur
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
reason of class cast exception is that you have not extended your calss with applet class thats why you are getting this exception .Please extend your calss with applet .
Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic