From e74347cdf83bf8a5d3f21ee1f83e3ea89f3a7a3e Mon Sep 17 00:00:00 2001 From: Dennis Eisold <de@itstall.de> Date: Wed, 6 Nov 2019 15:12:12 +0100 Subject: [PATCH] Small fixes --- src/de/itstall/TaschenrechnerGui.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/de/itstall/TaschenrechnerGui.java b/src/de/itstall/TaschenrechnerGui.java index 8fc2cd5..c6e8fe4 100644 --- a/src/de/itstall/TaschenrechnerGui.java +++ b/src/de/itstall/TaschenrechnerGui.java @@ -119,13 +119,14 @@ public class TaschenrechnerGui extends JFrame { this.setTitle("Taschenrechner"); this.setSize(300, 200); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - this.setResizable(false); + this.setResizable(true); panel = new JPanel(); panel.setLayout(new GridLayout(4, 5)); txtCalculation.setBounds(20, 20, 260, 20); txtCalculation.setHorizontalAlignment(JTextField.RIGHT); + txtCalculation.setEditable(false); this.add(txtCalculation, BorderLayout.PAGE_START); ActionListener insert = new InsertAction(); @@ -175,13 +176,15 @@ public class TaschenrechnerGui extends JFrame { strDisplay = strDisplay.replace("--", "-"); strDisplay = strDisplay.replace("-+-", "-"); strDisplay = strDisplay.replace("+-+", "+"); + strDisplay = strDisplay.replace("NaN", ""); } return strDisplay; } private void calculate() { - txtCalculation.setText("= " + berechnen(txtCalculation.getText())); + String txtCalc = replaceSigns(txtCalculation.getText()); + txtCalculation.setText("= " + berechnen(txtCalc)); } private void clearDisplay() { -- GitLab