2

我对 JavaFX 和 CSS 样式(以及 stackoverflow)相当陌生。我想知道如何设置列的表头样式。这是我的标题目前的样子: 我的表格视图列标题的当前样式

这就是我想要的样子: 我想要实现的样式

我尝试应用以下css样式但无济于事:

.table-view .column-header .nested-column-header
{
    -fx-background-color: #AAAAAA;
    -fx-background-radius: 0;
    -fx-background-insets: 0;
    -fx-effect: dropshadow(gaussian, rgba(0, 0, 0, 0.6), 2, 0.5, 1, 1);
}

.table-view .column-header
{
    -fx-background-color: #AAAAAA;
    -fx-background-radius: 0;
    -fx-background-insets: 0;
    -fx-effect: dropshadow(gaussian, rgba(0, 0, 0, 0.6), 2, 0.5, 1, 1);
}

.table-view .column-header .filter
{
    -fx-background-color: #AAAAAA;
    -fx-background-radius: 0;
    -fx-background-insets: 0;
    -fx-effect: dropshadow(gaussian, rgba(0, 0, 0, 0.6), 2, 0.5, 1, 1);
}

我还检查了 jfxrt.jar 中的 caspian.css 文件,但这无法为我指明正确的方向。

因此,如果有人有任何想法,那就太好了。:) 先感谢您。

4

1 回答 1

12

我建议尝试以下样式类:

.table-view .column-header-background

我用这个 css 改变了我的列标题背景,它起作用了:

.table-view .column-header,
.table-view .column-header .filler,
.table-view .column-header-background .filler {
    -fx-background-color: red;
}

你确定你没有树表吗?因为样式类被命名tree-table-view而不是table-view.

于 2016-04-18T07:40:16.240 回答