gpt4 book ai didi

css - JavaFX TableView 换行文本选中行文本颜色

转载 作者:行者123 更新时间:2023-11-28 04:13:13 24 4
gpt4 key购买 nike

我使用 Stackoverflow 将文本包装在表格单元格中。但是当我关注表格行时,文本颜色不再改变。我什么都试过了。

这是我现在在 Controller 中的内容:

       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;
}

最佳答案

你需要类似的东西

.table-cell .coltext {
-fx-fill: white ;
}

.table-cell:focused:filled:selected .coltext {
-fx-fill: black ;
}

(我假设 coltextdraaiboektext 应该是同一件事。)

关于css - JavaFX TableView 换行文本选中行文本颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42611436/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com