Link zu www.kneller-gifs.de

Applet Textausgabe

Kleines Java-Applet das einen Text ausgibt.
  import java.awt.*;
  import java.applet.*;
  public class Applet1 extends Applet {
    TextField tf1 = new TextField(20);
    TextField tf2 = new TextField(20);
    TextArea  ta1 = new TextArea(10,50);

    public void start() {}

    public void init() {
      setBackground(Color.yellow);
      add(tf1);
      add(ta1);
      add(tf2);
    }

    public void paint(Graphics g){
      g.drawString("Hallo!", 20, 300);
    }

    public void stop() {}

    public void destroy() {}
  }
Starten der Applet-Klasse per HTML-Datei im selben Verzeichnis:
  <html>
  <body>
  Test
  <applet code="Applet1.class" width="400" height="300" alt="Test-Applet">
  </applet>
  </body>
  </html>