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); Scene mainWindowScene = new Scene(rootNode);
primaryStage.setScene(mainWindowScene); primaryStage.setScene(mainWindowScene);
primaryStage.setMinWidth(400);
primaryStage.setMinHeight(320);
primaryStage.show(); primaryStage.show();
} catch(Exception e) { } catch(Exception e) {
e.printStackTrace(); e.printStackTrace();

View File

@ -52,11 +52,17 @@ public class MainWindowController {
@FXML @FXML
void calculate(ActionEvent event) { void calculate(ActionEvent event) {
valueHandlerDecorator.checkValuesAndCalculateResult(initialAmount.getText(), returnInPercent.getText(), annualCost.getText(), numberOfYears.getText()); 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 @FXML
void clearResults(ActionEvent event) { void clearResults(ActionEvent event) {
valueHandlerDecorator.clearResult(); valueHandlerDecorator.clearResult();
results.setBorder(null);
} }
@ -109,6 +115,7 @@ public class MainWindowController {
@FXML @FXML
void showHelp(ActionEvent event) { void showHelp(ActionEvent event) {
valueHandlerDecorator.showHelp(helpText); valueHandlerDecorator.showHelp(helpText);
results.setBorder(new Border(new BorderStroke(Color.BLUE, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(2))));
} }
public void setValueHandler(ValueHandler valueHandler){ public void setValueHandler(ValueHandler valueHandler){
@ -118,11 +125,6 @@ public class MainWindowController {
@Override @Override
public void update() { public void update() {
results.setText(valueHandler.getResultBound()); 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 @Override
public void update() { public void update() {
results.setText(valueHandler.getResultBound()); 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))));
}
} }
}); });
} }