预览: 代码: import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; public class Calculator implements ActionListener{ private double tempNum = 0; //存放正在构造的数 private double backNum = 0; //存放第一个数 private double pointCount = 1; //累计小数后的位数 private int pointBackCount = 1; //累计倍数为小数退格所用 private int calculateState = 0; //判断当前的运算状态 private int calculateCount = 0; //进行计算的次数 private boolean pointState = false; //判断开始输入小数 private JFrame f = new JFrame("计算器"); private JPanel pAll = new JPanel(); private JPanel pLeft = new JPanel(); private JPanel pRight = new JPanel(); private JPanel pLeft1 = new JPanel(); private JPanel pLeft2 = new JPanel(); private JPanel pRight1 = new JPanel(); priv