From 40b0d4170b613b4c1d9b6d76a6ec5addb55697a0 Mon Sep 17 00:00:00 2001 From: Admin <1510379943@qq.com> Date: Sat, 12 Oct 2024 17:35:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CalculatorController.java | 5 ++--- .../Calculator/CalculatorController.class | Bin 5153 -> 5162 bytes 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/CalculatorController.java b/CalculatorController.java index 70144cf..af4e5da 100644 --- a/CalculatorController.java +++ b/CalculatorController.java @@ -71,9 +71,9 @@ public class CalculatorController { } String firstNumberText = (firstNumber % 1 == 0) ? String.valueOf((int) firstNumber) : String.valueOf(firstNumber); operator = op; - currentInput.setLength(0); // 清空当前输入以便输入下一个数字 isOperationClicked = true; - inputField.setText(firstNumberText + " " + operator); // 显示当前操作 + currentInput.append(operator); + inputField.setText(firstNumberText + " " + operator + " "); // 显示当前操作 } @FXML @@ -140,7 +140,6 @@ public class CalculatorController { if (currentInput.length() > 0) { // 移除最后一个字符 currentInput.deleteCharAt(currentInput.length() - 1); - // 如果最后一个字符是空格且还有字符,继续删除空格(用于清理运算符后面的空格) while (currentInput.length() > 0 && currentInput.charAt(currentInput.length() - 1) == ' ') { currentInput.deleteCharAt(currentInput.length() - 1); diff --git a/out/production/Calculator/CalculatorController.class b/out/production/Calculator/CalculatorController.class index d9d7840771f0f7326f5dff5c99b455094c909257..086cf3f585ae7d9613e9af0eff7caee645426263 100644 GIT binary patch delta 178 zcmXAhJqtl$07eh4a)&qEONxO-iH%L{zRP4_vQRRSMfnFrZ$LRwF29A`z>Sr$K=sMKY=g{X4Sc z6sZSlq_9vXeS3?x<{gt{LWwDLW;B`8V-aRjF{N=v-~_rVEK4yPuk(N}A@;ZuHV-G< znMqc8r_Ki*3gopOy+?TEO+THZLJkK-vj124EgpNk(C3o@HHI`8(PpfE%vRtRFH