I need to display the javafx tree table with values read from XML file. I am able to do it as shown below,
I am able to add color to the combo box as shown
Your issue seems to be in your update item.
You are checking that it's not empty, then if empty set back to ""...
if(!empty) {
if (status == null || empty) {
setStyle("");
}
etc...
Just remove the outer check - you don't the our if(!empty){}
Just use this:
if (status == null || empty) {
setStyle("");
}
else if (clmStatus.equals("Passed")) {
setTextFill(Color.BLACK);
setStyle("-fx-background-color: green");
setText(clmStatus);
} else if (clmStatus.equals("Failed")){
setTextFill(Color.BLACK);
setStyle("-fx-background-color: red");
setText(clmStatus);
} else if (clmStatus.equals("NotRelevant")){
setTextFill(Color.BLACK);
setStyle("-fx-background-color: blue");
setText(clmStatus);
}