From 242d035756496210086462cf276c71ddebeb7dd9 Mon Sep 17 00:00:00 2001 From: romanschenk37 <84532681+romanschenk37@users.noreply.github.com> Date: Wed, 30 Mar 2022 13:36:53 +0200 Subject: [PATCH] Aufgabe 4 angepasst. --- .../ch/zhaw/prog2/fxmlcalculator/MainWindowController.java | 5 +++++ .../zhaw/prog2/fxmlcalculator/ResultWindowController.java | 7 +++++++ 2 files changed, 12 insertions(+) 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 fd1a0d7..1468c22 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 @@ -118,6 +118,11 @@ 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 bce37fd..c92142f 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 @@ -2,6 +2,8 @@ package ch.zhaw.prog2.fxmlcalculator; import javafx.fxml.FXML; import javafx.scene.control.TextArea; +import javafx.scene.layout.*; +import javafx.scene.paint.Color; import javafx.stage.Stage; /** @@ -30,6 +32,11 @@ 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)))); + } } }); }