This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Frame & Applet

 
Thiru Thangavelu
Ranch Hand
Posts: 219
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why "hello world" is not printed when the constructor is present?

[ June 12, 2002: Message edited by: Thiru Thangavelu ]
[ June 12, 2002: Message edited by: Thiru Thangavelu ]
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shouldn't that be text=s;
 
Jose Botella
Ranch Hand
Posts: 2120
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The default constructor is needed. Otherwise, how the browser is going to pass the parameter?
 
Thiru Thangavelu
Ranch Hand
Posts: 219
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, it is text = s
Why do we need the default constructor since we have the string "hello world" as parameter text. I think I am missing some concept here.
 
Jose Botella
Ranch Hand
Posts: 2120
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is not needed for setting the value of text, but in case the applet is going to be executed by a browser.
 
Brusk Baran
Ranch Hand
Posts: 132
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Applet vs Application??
I converted the applet so that it can be run as an application too.
is this allowed???
import java.awt.*;
import java.applet.Applet;
public class TestAppletMain extends Applet {
private String text = "Hello World";
public void init() {
add(new Label(text));
}
/*
public TestAppletMain (String s) {
text = s;
}
*/
public static void main(String args []){
TestAppletMain ss = new TestAppletMain ();
ss.init();
}
}
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic