I have a JavaFX TreeView
and want to change the font color of a selected cell to black, to make it look like a non-selected cell. (I tried setSelectionModel(null)
but this throws errors.) The cells have a transparent background on a background image, if that matters.
CSS:
.tree-view, .tree-cell {
-fx-font: 20px "Segoe Print";
-fx-background-color: transparent;
}
.tree-cell {
-fx-background-color: transparent;
-fx-padding: 0 0 0 0;
-fx-text-fill: #000000;
}
.tree-cell:focused {
-fx-text-fill: #000000;
}
.tree-cell:selected {
-fx-text-fill: #000000;
}
.tree-cell .tree-disclosure-node {
-fx-background-color: transparent;
-fx-padding: 10 10 0 40;
}
.button {
-fx-padding: 0 10 0 10;
}
Result: ("test4" is selected)
This seems like it should set the font color for selected cells to black, but it's not happening. The CSS file is loaded and being used (the font is correct, for instance, and I've modified other things as well), so that's not the issue.
If you just want transparent backgrounds and for the selected cells to appear the same as non-selected cells, you can do: