11package fjwright .runreduce ;
22
3+ import javafx .beans .binding .ObjectBinding ;
4+ import javafx .beans .property .ObjectProperty ;
35import javafx .event .ActionEvent ;
46import javafx .fxml .FXML ;
57import javafx .scene .Node ;
@@ -18,30 +20,38 @@ public class FontColorsDialog {
1820 private ColorPicker algebraicInputColorPicker , symbolicInputColorPicker ,
1921 algebraicOutputColorPicker , symbolicOutputColorPicker , warningColorPicker , errorColorPicker ;
2022
23+ private ObjectProperty <Color > warningColorPickerValueProperty ;
24+ private ObjectBinding <Background > warningLabelBackgroundBinding ;
25+
2126 @ FXML
2227 private void initialize () {
2328 algebraicInputLabel .textFillProperty ().bind (algebraicInputColorPicker .valueProperty ());
2429 symbolicInputLabel .textFillProperty ().bind (symbolicInputColorPicker .valueProperty ());
2530 algebraicOutputLabel .textFillProperty ().bind (algebraicOutputColorPicker .valueProperty ());
2631 symbolicOutputLabel .textFillProperty ().bind (symbolicOutputColorPicker .valueProperty ());
32+ warningColorPickerValueProperty = warningColorPicker .valueProperty ();
33+ warningLabelBackgroundBinding = new ObjectBinding <>() {
34+ {
35+ super .bind (warningColorPickerValueProperty );
36+ }
37+
38+ @ Override
39+ protected Background computeValue () {
40+ return new Background (
41+ new BackgroundFill (warningColorPickerValueProperty .get (), null , null ));
42+ }
43+ };
44+ warningLabel .backgroundProperty ().bind (warningLabelBackgroundBinding );
2745
2846 algebraicInputColorPicker .setValue (Color .web (FontColors .algebraicInput ));
2947 symbolicInputColorPicker .setValue (Color .web (FontColors .symbolicInput ));
3048 algebraicOutputColorPicker .setValue (Color .web (FontColors .algebraicOutput ));
3149 symbolicOutputColorPicker .setValue (Color .web (FontColors .symbolicOutput ));
50+ warningColorPicker .setValue (Color .web (FontColors .warning ));
51+ errorColorPicker .setValue (Color .web (FontColors .error ));
3252
33- Color color = Color .web (FontColors .warning );
34- warningLabel .setBackground (new Background (new BackgroundFill (color , null , null )));
35- warningColorPicker .setValue (color );
36- color = Color .web (FontColors .error );
37- errorLabel .setBackground (new Background (new BackgroundFill (color , null , null )));
38- errorColorPicker .setValue (color );
39- }
40-
41- public void warningColourAction (ActionEvent actionEvent ) {
42- }
43-
44- public void errorColourAction (ActionEvent actionEvent ) {
53+ // warningLabel.setBackground(new Background(new BackgroundFill(color, null, null)));
54+ // errorLabel.setBackground(new Background(new BackgroundFill(color, null, null)));
4555 }
4656
4757 /**
0 commit comments