I'm trying to work out what the process is when a simple hello world applet runs.
The init() method is called by default when the class is used, I assume. However, the paint method is the one that actually displays text. When / where is that called from?
It appears to be passsed a parameter of type Graphics, but I can't see where any of this is happening ...
Ben
import java.awt.Graphics;
public class HelloWorld extends java.applet.Applet {
public void init() {
resize(150,25);
}
public void paint(Graphics g) {
g.drawString("Hello world!", 50, 25);
}
}
The init() method is called by default when the class is used, I assume. However, the paint method is the one that actually displays text. When / where is that called from?
It appears to be passsed a parameter of type Graphics, but I can't see where any of this is happening ...
Ben
import java.awt.Graphics;
public class HelloWorld extends java.applet.Applet {
public void init() {
resize(150,25);
}
public void paint(Graphics g) {
g.drawString("Hello world!", 50, 25);
}
}