//All applets must be declared
public
public class HelloWorld2 extends Applet{
//Declare objects
String text;
Font font;
//this method does the initializing
public void init(){
text="Hello World";
font=new Font("Helvetica",Font.BOLD,24);
setBackground(Color.black);
}
//This method paints the graphic
to the applet
//in this example only the String
Hello world
//If you want another text,
just change the init method
public void paint(Graphics
g){
//Draws a nice frame for the
String
g.setColor(Color.blue);
g.fillRect(20,20,160,60);
g.setColor(Color.red);
g.fillRect(25,25,150,50);
//Sets the font which the applet
will use to draw the String
g.setFont(font);
//actually paints the string
in position 33,34
g.setColor(Color.white);
g.drawString(text,33,58);
}
}