Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

///applet///

 
chao-long liao
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
import java.applet.Applet;
import java.awt.*;
public class Sample extends Applet {
private String text = "Hello World";
public void init() {
add(new Label(text));
}
public Sample (String string) {
text = string;
}}
Viewing with another .htm,compile OK,but runtime error,I forget the reason.?
Applet can not has the constructor ?
Thanks.
liao
 
Jamal Hasanov
Ranch Hand
Posts: 411
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try to add default constructor
public Sample () {
this("default");
}
Jamal Hasanov
www.j-think.com
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic