用JAVA做乘法计算器,不用适配器

来源:百度知道 编辑:UC知道 时间:2024/05/25 14:49:30
我是初学者,不用太难,越简单越好。

我自己写的,已经调试成功。

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

public class MulCounter extends JFrame implements ActionListener {
private JTextField result = new JTextField("0");

private JButton[] num = new JButton[10];

private static JButton point = new JButton(".");

private static JButton mul = new JButton("×");

private static JButton equal = new JButton("=");

private static JButton eraser = new JButton("C");

private String display = "";

private String tmp;

public MulCounter() {
super("乘法计算器");
setBounds(300, 300, 200, 250);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
GridBagLayout gbl = new GridBagLayout();
GridBagConstraints constraints = new GridBagConstraints();
JPanel pane = new JPanel();