Jan 02

HelloWWW.java Basic Hello World (Wide Web) Applet

*********************
import java.applet.Applet;
import java.awt.*;

*********************
 
public class HelloWWW extends Applet {
  private int fontSize = 40;
  
  public void init() {
    setBackground(Color.black);
    setForeground(Color.white);
    setFont(new Font("SansSerif", Font.BOLD, fontSize));
  }
  
  public void paint(Graphics g) {
    g.drawString("Hello, World Wide Web.", 5, fontSize+5);
  }
}
< <<<<<<<<<<<<<<<<<<<<

Note: Brought from our old site: http://www.salearningschool.com/example_codes/ on Jan 2nd, 2017

Skip to toolbar