import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class MyFrame extends JFrame
implements ActionListener {
JLabel l;
JButton b1, b2, b3, b4, b5, b6, b7, b8, b9, b0, bclear, bstop;
public MyFrame(){
l = new JLabel(" ");
l.setFont(new Font("times", Font.PLAIN, 66));
l.setOpaque(true);
l.setBackground(Color.blue);
JPanel panel = new JPanel();
Container c = getContentPane();
c.add(l, BorderLayout.NORTH);
c.add(panel, BorderLayout.CENTER);
b1 = new JButton("1");
b1.addActionListener(this);
b2 = new JButton("2");
b2.addActionListener(this);
b3 = new JButton("3");
b3.addActionListener(this);
b4 = new JButton("4");
b4.addActionListener(this);
b5 = new JButton("5");
b5.addActionListener(this);
b6 = new JButton("6");
b6.addActionListener(this);
b7 = new JButton("7");
b7.addActionListener(this);
b8 = new JButton("8");
b8.addActionListener(this);
b9 = new JButton("9");
b9.addActionListener(this);
b0 = new JButton("0");
b0.addActionListener(this);
bclear = new JButton("clear");
bclear.addActionListener(this);
bstop = new JButton("stop");
bstop.addActionListener(this);
panel.setLayout(new GridLayout(4,1));
panel.add (b1);
panel.add (b2);
panel.add (b3);
panel.add (b4);
panel.add (b5);
panel.add (b6);
panel.add (b7);
panel.add (b8);
panel.add (b9);
panel.add (bclear);
panel.add (b0);
panel.add (bstop);
setTitle("een rekenmachine");
setSize(800, 400);
setVisible(true);
setDefaultCloseOperation(EXIT_ON_CLOSE);}
public void actionPerformed(ActionEvent e) {
if (e.getSource() == b1)
l.setText("1");
if (e.getSource() == b2)
l.setText("2");
if (e.getSource() == b3)
l.setText("3");
if (e.getSource() == b4)
l.setText("4");
if (e.getSource() == b5)
l.setText("5");
if (e.getSource() == b6)
l.setText("6");
if (e.getSource() == b7)
l.setText("7");
if (e.getSource() == b8)
l.setText("8");
if (e.getSource() == b9)
l.setText("9");
if (e.getSource() == b0)
l.setText("0");
if (e.getSource() == bclear)
l.setText(" ");
if (e.getSource() == bstop)
l.setText("exit");
}
}