• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java applet problem using super()

 
David Llewellyn
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • 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
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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().
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic