• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

java applet problem using super()

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I'm converting a java app I wrote into an applet (which im quite new to), I'm having trouble with the following code:

public BasicConstruct(String name)
{
super(name);
initial_setup();
}

I call it from the init() method with a string. My java compiler gives the following error:
cannot resolve symbol
symbol : constructor JApplet (java.lang.String)
location: class javax.swing.JApplet
super(name);
^

could someone give me a clue what Im doing wrong?
cheers
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi David,

Well, the compiler message is pretty self-explanatory; you're using "super()" to call a JApplet constructor which takes a String as an argument, but there is no such constructor. What was the superclass of BasicConstruct before you started doing this conversion? What did it do with that String? You'll have to decide how to implement that yourself in the Applet. If, for example, the old superclass was JFrame, then the String was the window title. Since Applets don't have a window title, you might just simply remove the argument altogether.
 
David Llewellyn
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yep, the original constructor was a JFrame, so i simply removed the argument and now it compiles. All i see though is a black screen (not the standard applet grey screen).
I think that its something I need to change in the Java3D code though.

cheers again Ernest!
 
David Llewellyn
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmmm, I still can't get it working, my compiler is now giving me the error:
java.lang.NoSuchMethodError: main
Exception in thread "main"

But surely this shouldn't happen because Im extending JApplet, therefore im using init() not main()??
 
David Llewellyn
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I fixed it eventually, I'd accidentally left arguments within the init() method parameter brackets, so it was not overloading the standard JApplet init().
 
reply
    Bookmark Topic Watch Topic
  • New Topic