package a;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
public class Fenster implements ActionListener {
private static final int ActionEvent = 0;
public Fenster() {
JFrame Fenster = new JFrame();
Fenster.setTitle("Der vernünftige Taschenrechner mit GUI und mit Mauseingabe");
Fenster.setSize(800, 600);
Fenster.setLayout(null);
Fenster.setResizable(true);
Fenster.setDefaultCloseOperation(Fenster.EXIT_ON_CLOSE);
Fenster.requestFocus();
Fenster.setVisible(true);
Fenster.setLocationRelativeTo(null);
JButton b1 = new JButton("1");
JButton b2 = new JButton("2");
JButton b3 = new JButton("3");
JButton b4 = new JButton("4");
JButton b5 = new JButton("5");
JButton b6 = new JButton("6");
JButton b7 = new JButton("7");
JButton b8 = new JButton("8");
JButton b9 = new JButton("9");
JButton b0 = new JButton("0");
b1.setBounds(385, 250, 50, 30);
b2.setBounds(435, 250, 50, 30);
b3.setBounds(485, 250, 50, 30);
b4.setBounds(385, 280, 50, 30);
b5.setBounds(435, 280, 50, 30);
b6.setBounds(485, 280, 50, 30);
b7.setBounds(385, 310, 50, 30);
b8.setBounds(435, 310, 50, 30);
b9.setBounds(485, 310, 50, 30);
b0.setBounds(435, 340, 50, 30);
Fenster.add(b1);
Fenster.add(b2);
Fenster.add(b3);
Fenster.add(b4);
Fenster.add(b5);
Fenster.add(b6);
Fenster.add(b7);
Fenster.add(b8);
Fenster.add(b9);
Fenster.add(b0);
Draw lbl1 = new Draw();
Fenster.add(lbl1);
lbl1.setVisible(true);
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
b5.addActionListener(this);
b6.addActionListener(this);
b7.addActionListener(this);
b8.addActionListener(this);
b9.addActionListener(this);
b0.addActionListener(this);
}
}
@Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == b1 ) {
System.out.println("1");
}
}
}