使用自定义CSS时,JavaFX表上的滚动条会留下空白区域

Ist*_*tch 5 css javafx javafx-8

一张图片胜过千言万语:

使用自定义css在表的角落的白色空间 .

正如你所看到我在这张桌子上使用自定义CSS,但我不能填充右上角.我尝试更改滚动窗格的背景而没有结果.

这是实际的CSS:

.table-row-cell {
  -fx-background-color: rgba(71, 81, 80,0.5);
}

.table-row-cell:hover {
  -fx-background-color: rgba(40, 96, 93, 0.50);
}

.table-row-cell:hover:empty {
  -fx-background-color: rgba(71, 81, 80,0.5);
}

.table-row-cell .table-cell {
  -fx-border-width: 0px;

}

.table-view {
  -fx-border-color: rgba(1, 11, 12, 1);
  -fx-background-radius: 2;
  -fx-border-width: 1px;
  -fx-border-radius: 2;
  -fx-background-color: rgba(71, 81, 80,0.2);
  -fx-background-insets: 0;
}

.table-view .column-header {
  -fx-background-color: rgba(1, 11, 12, 1);
}

.scroll-bar {
  -fx-background-color: rgba(1, 11, 12, 1);
}

.scroll-bar .increment-button:hover {
  -fx-background-color: rgba(1, 11, 12, 1);
}

.scroll-bar .decrement-button:hover {
  -fx-background-color: rgba(1, 11, 12, 1);
}

.scroll-bar .thumb {
  -fx-background-color: rgba(71, 81, 80,0.5);
}
Run Code Online (Sandbox Code Playgroud)

任何帮助将非常感激.

Ist*_*tch 5

我最终找到了解决方法,感谢@James_D帮助我找到解决方案.

该角不是滚动窗格的一部分,而是table.view标题.因此,您可以使用此代码更改背景.

填充是必要的,因为它在没有它的情况下在右侧留下一条奇怪的白线.

.table-view .column-header-background .filler {
  -fx-background-color: rgba(1, 11, 12, 1);
  -fx-padding: 1em;
}
Run Code Online (Sandbox Code Playgroud)

如果您找到更好的方法来实现这一目标,欢迎您的回答.