From 41c6789c645b9bee2bc0ff1e38b1a9dfdc565c3e Mon Sep 17 00:00:00 2001 From: romanschenk37 <84532681+romanschenk37@users.noreply.github.com> Date: Wed, 30 Mar 2022 22:02:28 +0200 Subject: [PATCH] Aufgabe 4 Designanpassung. --- .../main/java/ch/zhaw/prog2/fxmlcalculator/Main.java | 2 ++ .../prog2/fxmlcalculator/MainWindowController.java | 12 +++++++----- .../prog2/fxmlcalculator/ResultWindowController.java | 5 ----- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/code/FXML-Calculator/src/main/java/ch/zhaw/prog2/fxmlcalculator/Main.java b/code/FXML-Calculator/src/main/java/ch/zhaw/prog2/fxmlcalculator/Main.java index 7fdb7ea..6ba54f8 100644 --- a/code/FXML-Calculator/src/main/java/ch/zhaw/prog2/fxmlcalculator/Main.java +++ b/code/FXML-Calculator/src/main/java/ch/zhaw/prog2/fxmlcalculator/Main.java @@ -52,6 +52,8 @@ public class Main extends Application { Scene mainWindowScene = new Scene(rootNode); primaryStage.setScene(mainWindowScene); + primaryStage.setMinWidth(400); + primaryStage.setMinHeight(320); primaryStage.show(); } catch(Exception e) { e.printStackTrace(); diff --git a/code/FXML-Calculator/src/main/java/ch/zhaw/prog2/fxmlcalculator/MainWindowController.java b/code/FXML-Calculator/src/main/java/ch/zhaw/prog2/fxmlcalculator/MainWindowController.java index 1468c22..65dc34d 100644 --- a/code/FXML-Calculator/src/main/java/ch/zhaw/prog2/fxmlcalculator/MainWindowController.java +++ b/code/FXML-Calculator/src/main/java/ch/zhaw/prog2/fxmlcalculator/MainWindowController.java @@ -52,11 +52,17 @@ public class MainWindowController { @FXML void calculate(ActionEvent event) { valueHandlerDecorator.checkValuesAndCalculateResult(initialAmount.getText(), returnInPercent.getText(), annualCost.getText(), numberOfYears.getText()); + if(valueHandler.areValuesOk()){ + results.setBorder(new Border(new BorderStroke(Color.GREEN, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(2)))); + }else { + results.setBorder(new Border(new BorderStroke(Color.RED, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(2)))); + } } @FXML void clearResults(ActionEvent event) { valueHandlerDecorator.clearResult(); + results.setBorder(null); } @@ -109,6 +115,7 @@ public class MainWindowController { @FXML void showHelp(ActionEvent event) { valueHandlerDecorator.showHelp(helpText); + results.setBorder(new Border(new BorderStroke(Color.BLUE, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(2)))); } public void setValueHandler(ValueHandler valueHandler){ @@ -118,11 +125,6 @@ public class MainWindowController { @Override public void update() { results.setText(valueHandler.getResultBound()); - if(valueHandler.areValuesOk()){ - results.setBorder(new Border(new BorderStroke(Color.GREEN, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(1)))); - }else { - results.setBorder(new Border(new BorderStroke(Color.RED, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(1)))); - } } }); } diff --git a/code/FXML-Calculator/src/main/java/ch/zhaw/prog2/fxmlcalculator/ResultWindowController.java b/code/FXML-Calculator/src/main/java/ch/zhaw/prog2/fxmlcalculator/ResultWindowController.java index c92142f..c004cbf 100644 --- a/code/FXML-Calculator/src/main/java/ch/zhaw/prog2/fxmlcalculator/ResultWindowController.java +++ b/code/FXML-Calculator/src/main/java/ch/zhaw/prog2/fxmlcalculator/ResultWindowController.java @@ -32,11 +32,6 @@ public class ResultWindowController { @Override public void update() { results.setText(valueHandler.getResultBound()); - if(valueHandler.areValuesOk()){ - results.setBorder(new Border(new BorderStroke(Color.GREEN, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(1)))); - }else { - results.setBorder(new Border(new BorderStroke(Color.RED, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(1)))); - } } }); }