HTML gevorderde |
|
Nou, zo begin je dan:
Je opent kladblok (of iets dergelijks)
En je slaat dit bestand op als app.java:
import java.awt.*;
import java.awt.event.*;
public class app extends Frame implements WindowListener
{
public static void main(String[] args)
{
app prog = new app();
prog.setSize(800,600);
prog.setVisible(true);
}
public app()
{
setLayout(null);
addWindowListener(this);
}
public void paint(Graphics g)
{
g.drawString("This should work :p",10,100);
}
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
public void windowIconified(WindowEvent event) {}
public void windowOpened(WindowEvent event) {}
public void windowClosed(WindowEvent event) {}
public void windowDeiconified(WindowEvent event) {}
public void windowActivated(WindowEvent event) {}
public void windowDeactivated(WindowEvent event) {}
}
import java.awt.*; import java.awt.event.*; public class app extends Frame implements WindowListener { public static void main (String [] args ) { app prog = new app(); prog.setSize(800,600); prog.setVisible(true); } public app() { setLayout(null); addWindowListener(this); } public void paint(Graphics g) { g.drawString("This should work :p",10,100); } public void windowClosing(WindowEvent e) { } public void windowIconified(WindowEvent event) {} public void windowOpened(WindowEvent event) {} public void windowClosed(WindowEvent event) {} public void windowDeiconified(WindowEvent event) {} public void windowActivated(WindowEvent event) {} public void windowDeactivated(WindowEvent event) {} }
Je compilet, en je hebt je eerste frame gemaakt |