Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

css - How to change the text color of entire row's cells in JavaFX TableView?

I'm trying to change the text color of rows in a TableView. I need to change the text color in every row that the cell in the Deleted column says "Yes".

When using the setRowFactory() method, I've tried checking the row data's object isDeleted field, and when it is true, using setStyle("-fx-text-fill: blue;") which did not work.

I would appreciate any advice on how to accomplish this.

UPDATE:

I found the answer after a lot of searching. By adding a custom class to the rows that their text needed changing, and loading a css file with the code:

.some-class .table-cell{
     -fx-text-fill: blue;
}

I've managed to get the desired result.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...