Simple Java GUI Anwendung: "Hello World"
HelloWorld.java
import java.awt.*;
public class HelloAWT
extends Frame {
public HelloWorld() {
setTitle("Hello World!"); // Optional
setSize(400,400);
setVisible(true);
}
public static void main
(String[] args
){
new HelloWorld();
}
}
"Das ist das Haus vom Nikolaus"
HausVomNikolaus.java
import java.awt.*;
public class HausVomNikolaus
extends Frame {
int x[] ={150, 250, 250, 150, 150, 250, 200, 150, 250};
int y[] ={300, 200, 300, 300, 200, 200, 120, 200, 300};
public HausVomNikolaus() {
setTitle("Das Haus vom Nikolaus");
setSize(400, 400);
setVisible(true);
}
g.drawString("Das Haus vom Nikolaus!", 100 ,40 );
g.drawPolyline(x,y,9);
}
public static void main
(String[] args
) {
new HausVomNikolaus();
}
}
Links