Aufgabe 4 Designanpassung.

This commit is contained in:
romanschenk37 2022-03-30 22:02:28 +02:00
parent 242d035756
commit 41c6789c64
3 changed files with 9 additions and 10 deletions

View File

@ -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();

View File

@ -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))));
}
}
});
}

View File

@ -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))));
}
}
});
}