
import java.awt.*;
import java.awt.event.*;
public class FirstButton extends Frame implements ActionListener {
    Label label;
    Button button;
    public FirstButton() {
        setLayout(FlowLayout);
        setBackground(Color.orange);
        setFont(new Font("SansSerif", Font.BOLD, 18));
        label = new Label();
        label.setText("This is my first button :-)");
        add(label);
        button = new Button("Knopf");
        button.setBackground(Color.white);
        button.addActionListener(this);
        add(button);button.setVisible(true);
        setVisible(true);
    }
    public void paint(Graphics page) {
        page.setColor(Color.red);
        page.fillRect(200,0,100,100);
        page.setColor(Color.blue);
        page.fillRect(225,25,50,50);
    }
    public void actionPerformed(ActionEvent e) {
        label.setText("Damn - you pressed it ...");
        System.out.println(e);
        remove(button);
    }
    public static void main(String args[]) {
        new FirstButton();
    }
} // end of FirstButton
     
