GUI-Beispiel

public static void main(String[] args) {
  JFrame f = new JFrame ("Demo");
  f.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
  JButton b = new JButton ("but");
  f.getContentPane().add (b);
  b.addActionListener (new ActionListener () {
    public void actionPerformed(ActionEvent e) {
      System.out.println("click");
    } });
  f.pack(); f.setVisible(true);
}

vgl. http://docs.oracle.com/javase/tutorial/uiswing/components/frame.html



Johannes Waldmann 2012-02-01