0
我用Stackoverflow来包装表格单元格中的文本。但是当我专注于表格行时,文字颜色不再改变。我尝试了一切。JavaFX TableView封装文本选择行文本颜色
这是我现在在我的控制器:
colWie.setCellFactory(column -> {
return new TableCell<DraaiboekActie, String>() {
private Text text;
@Override
public void updateItem(String item, boolean empty) {
super.updateItem(item, empty);
if (!isEmpty()) {
text = new Text(item);
text.wrappingWidthProperty().bind(colWie.widthProperty());
text.getStyleClass().add("coltext");
setGraphic(text);
}
}
};
});
这是我在我的CSS:
.coltext {
-fx-fill: white;
}
.coltext:focused:selected:filled{
-fx-fill: black;
}