diff --git a/src/de/itstall/TaschenrechnerGui.java b/src/de/itstall/TaschenrechnerGui.java index 8fc2cd5938538eb0ad3ad17997a3f5f022bf4aec..c6e8fe4b3a2b69ac5e174e6ab0f8613d5581ebf7 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() {