[英]How to color custom column exactly like a header in JavaFX?
默認樣式表使用
-fx-background-color: -fx-box-border, -fx-inner-border, -fx-body-color;
-fx-background-insets: 0, 0 1 1 0, 1 2 2 1;
標頭。 因此,您可以嘗試執行以下操作:
.row-header-cell {
-fx-background-color: -fx-box-border, -fx-inner-border, -fx-body-color;
-fx-background-insets: 0, 0 1 1 0, 1 2 2 1;
}
.table-row-cell:selected .row-header-cell {
-fx-body-color: gold ;
}
然后在“行標題”列上使用單元格工廠:
TableColumn<...> rowHeaderColumn = ... ;
rowHeaderColumn.setCellFactory(col -> {
TableCell<...> cell = new TableCell<>();
cell.getStyleClass().add("row-header-cell");
return cell ;
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.