use JFrame and JPanel instead of just normal Frame and Panel by using
Code:
import javax.swing.*;
and get rid of container, in the end your main function should look like this.
Code:
public static void main(String[] args) {
JFrame frame = new JFrame();
frame.setTitle("Calculator");
frame.setSize(200, 200);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(new Calculator());
frame.setVisible(true);
}
JFrame has the .setDefaultCloseOperation() method so that takes the place of your listener and 5 lines of code.
with all those changes it works fine for me and looks great. GJ.