From 56776f3aa88fe52b70835e46e3b0d27edb03b681 Mon Sep 17 00:00:00 2001 From: 2745873016 <2745873016@qq.com> Date: Thu, 17 Oct 2024 16:16:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=A1=E7=AE=97=E5=99=A8?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Calculator.java | 35 ----------------------- out/production/computer/Calculator.class | Bin 4398 -> 4400 bytes 2 files changed, 35 deletions(-) diff --git a/Calculator.java b/Calculator.java index 885082f..745e8f4 100644 --- a/Calculator.java +++ b/Calculator.java @@ -7,41 +7,6 @@ import java.awt.event.ActionEvent; public class Calculator extends JFrame { private JTextField inputField; // 输入显示区域 - public Calculator() { - createUI(); - } - - private void createUI() { - // 设置窗口布局 - setLayout(new BorderLayout()); - - // 创建输入显示区域 - inputField = new JTextField("0"); - inputField.setEditable(false); - inputField.setHorizontalAlignment(JTextField.RIGHT); - add(inputField, BorderLayout.NORTH); - - // 创建面板用于放置按钮 - JPanel panel = new JPanel(); - panel.setLayout(new GridLayout(5, 4, 5, 5)); // 设置间距 - - // 创建数字和运算符按钮 - String[] buttons = {"7", "8", "9", "/", "4", "5", "6", "*", "1", "2", "3", "-", "0", ".", "=", "+", "C", "=》"}; - for (String b : buttons) { - JButton button = new JButton(b); - panel.add(button); - button.addActionListener(e -> press(e.getActionCommand())); - } - - // 添加面板到窗口 - add(panel, BorderLayout.CENTER); - - // 设置窗口属性 - setSize(500, 600); // 设置窗口大小 - setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - setTitle("计算器"); - setVisible(true); - } private void press(String command) { if ("C".equals(command)) { diff --git a/out/production/computer/Calculator.class b/out/production/computer/Calculator.class index fd7bf9b2fcc7270ce91d31ed92945cefdf410bf7..b17252488628f30df54178fad97110f113f7c05e 100644 GIT binary patch delta 1705 zcmY+EcW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