diff options
| author | Stefan Suhren <suhren.stefan@fh-swf.de> | 2015-06-15 14:21:27 +0200 |
|---|---|---|
| committer | Stefan Suhren <suhren.stefan@fh-swf.de> | 2015-06-15 14:21:27 +0200 |
| commit | 96b0868fb4a95ceabd4aeda992f6a90a44ae521f (patch) | |
| tree | 8810c6a4b3ec4f7d85832d1b528c7bdec3146be6 /src/de/fhswf/in/inf/upnfx | |
| parent | d8cd813ddc54c455eb3071795038b97b72dc1ee9 (diff) | |
| download | UpnFx-96b0868fb4a95ceabd4aeda992f6a90a44ae521f.tar.gz UpnFx-96b0868fb4a95ceabd4aeda992f6a90a44ae521f.zip | |
Remove a Sysout and fix a few problems with 0
Diffstat (limited to 'src/de/fhswf/in/inf/upnfx')
| -rw-r--r-- | src/de/fhswf/in/inf/upnfx/util/UPN.java | 6 | ||||
| -rw-r--r-- | src/de/fhswf/in/inf/upnfx/view/MainViewController.java | 15 |
2 files changed, 13 insertions, 8 deletions
diff --git a/src/de/fhswf/in/inf/upnfx/util/UPN.java b/src/de/fhswf/in/inf/upnfx/util/UPN.java index bc773d5..1918ba6 100644 --- a/src/de/fhswf/in/inf/upnfx/util/UPN.java +++ b/src/de/fhswf/in/inf/upnfx/util/UPN.java @@ -37,15 +37,13 @@ public class UPN { throw new IllegalArgumentException("Operator can't be null."); } - - System.out.println(operator); - + lastX = upnStack.peek(); operator.eval(upnStack); } - + public final void addDouble(Double newVal) { if (newVal == null) diff --git a/src/de/fhswf/in/inf/upnfx/view/MainViewController.java b/src/de/fhswf/in/inf/upnfx/view/MainViewController.java index 6a9a115..1ee9173 100644 --- a/src/de/fhswf/in/inf/upnfx/view/MainViewController.java +++ b/src/de/fhswf/in/inf/upnfx/view/MainViewController.java @@ -80,7 +80,7 @@ public class MainViewController private ObservableDoubleStack upnStack = upnClass.getStack(); private StringProperty newNumber = new SimpleStringProperty(""); - + private static Map<String, Operator> operators = new HashMap<>(); static @@ -103,7 +103,7 @@ public class MainViewController { txtField.textProperty().addListener(e -> { btnComma.setDisable(!newNumber.isEmpty().get() && newNumber.get().contains(".")); - btnZero.setDisable(!newNumber.isEmpty().get() && !newNumber.get().contains(".") && newNumber.get().contains("0")); + btnZero.setDisable(!newNumber.isEmpty().get() && !newNumber.get().contains(".") && newNumber.get().startsWith("0")); }); newNumber.addListener(e -> { @@ -114,7 +114,7 @@ public class MainViewController if(!newNumber.isEmpty().get()) { txtField.setText(newNumber.get()); - + btnPlus.setDisable(upnStack.size() < 1); btnMinus.setDisable(upnStack.size() < 1); btnMul.setDisable(upnStack.size() < 1); @@ -231,7 +231,14 @@ public class MainViewController private void handleNumber(String number) { - newNumber.set(newNumber.concat(number).get()); + if(newNumber.get().equals("0") && !number.equals(".")) + { + newNumber.set(number); + } + else + { + newNumber.set(newNumber.concat(number).get()); + } } @FXML |
