Skip to content

Commit 6bfc9be

Browse files
committed
Final version of Font Colors dialogue.
1 parent 13b3d98 commit 6bfc9be

2 files changed

Lines changed: 21 additions & 14 deletions

File tree

src/fjwright/runreduce/FontColorsDialog.fxml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@
5151
<Insets bottom="2.0" top="10.0"/>
5252
</padding>
5353
</Label>
54-
<Label fx:id="warningLabel" style="-fx-label-padding: 2;" text="Warning" GridPane.columnIndex="0"
54+
<Label fx:id="warningLabel" style="-fx-label-padding: 2;" text="*** Warning" GridPane.columnIndex="0"
5555
GridPane.rowIndex="6"/>
5656
<ColorPicker fx:id="warningColorPicker" GridPane.columnIndex="1" GridPane.rowIndex="6">
5757
<tooltip>
5858
<Tooltip fx:id="backgroundTooltip"
5959
text="Background colours are partially transparent by default.&#10;Click on Custom Color... to change the opacity."/>
6060
</tooltip>
6161
</ColorPicker>
62-
<Label fx:id="errorLabel" style="-fx-label-padding: 2;" text="Error" GridPane.columnIndex="0"
62+
<Label fx:id="errorLabel" style="-fx-label-padding: 2;" text="***** Error" GridPane.columnIndex="0"
6363
GridPane.rowIndex="7"/>
6464
<ColorPicker fx:id="errorColorPicker" GridPane.columnIndex="1" GridPane.rowIndex="7">
6565
<tooltip>

src/fjwright/runreduce/FontColorsDialog.java

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,38 +20,45 @@ public class FontColorsDialog {
2020
private ColorPicker algebraicInputColorPicker, symbolicInputColorPicker,
2121
algebraicOutputColorPicker, symbolicOutputColorPicker, warningColorPicker, errorColorPicker;
2222

23-
private ObjectProperty<Color> warningColorPickerValueProperty;
24-
private ObjectBinding<Background> warningLabelBackgroundBinding;
25-
2623
@FXML
2724
private void initialize() {
2825
algebraicInputLabel.textFillProperty().bind(algebraicInputColorPicker.valueProperty());
2926
symbolicInputLabel.textFillProperty().bind(symbolicInputColorPicker.valueProperty());
3027
algebraicOutputLabel.textFillProperty().bind(algebraicOutputColorPicker.valueProperty());
3128
symbolicOutputLabel.textFillProperty().bind(symbolicOutputColorPicker.valueProperty());
32-
warningColorPickerValueProperty = warningColorPicker.valueProperty();
33-
warningLabelBackgroundBinding = new ObjectBinding<>() {
29+
warningLabel.backgroundProperty().bind(new ObjectBinding<>() {
30+
final ObjectProperty<Color> colorObjectProperty = warningColorPicker.valueProperty();
31+
3432
{
35-
super.bind(warningColorPickerValueProperty);
33+
super.bind(colorObjectProperty);
3634
}
3735

3836
@Override
3937
protected Background computeValue() {
4038
return new Background(
41-
new BackgroundFill(warningColorPickerValueProperty.get(), null, null));
39+
new BackgroundFill(colorObjectProperty.get(), null, null));
40+
}
41+
});
42+
errorLabel.backgroundProperty().bind(new ObjectBinding<>() {
43+
final ObjectProperty<Color> colorObjectProperty = errorColorPicker.valueProperty();
44+
45+
{
46+
super.bind(colorObjectProperty);
4247
}
43-
};
44-
warningLabel.backgroundProperty().bind(warningLabelBackgroundBinding);
48+
49+
@Override
50+
protected Background computeValue() {
51+
return new Background(
52+
new BackgroundFill(colorObjectProperty.get(), null, null));
53+
}
54+
});
4555

4656
algebraicInputColorPicker.setValue(Color.web(FontColors.algebraicInput));
4757
symbolicInputColorPicker.setValue(Color.web(FontColors.symbolicInput));
4858
algebraicOutputColorPicker.setValue(Color.web(FontColors.algebraicOutput));
4959
symbolicOutputColorPicker.setValue(Color.web(FontColors.symbolicOutput));
5060
warningColorPicker.setValue(Color.web(FontColors.warning));
5161
errorColorPicker.setValue(Color.web(FontColors.error));
52-
53-
// warningLabel.setBackground(new Background(new BackgroundFill(color, null, null)));
54-
// errorLabel.setBackground(new Background(new BackgroundFill(color, null, null)));
5562
}
5663

5764
/**

0 commit comments

Comments
 (0)