TableView 的样式是怎样的?
How are TableView styled?
如图,问题出在table的右下角。我想将白色方块的颜色更改为蓝色,但我做不到。我尝试设置 ScrollPane
的样式,但它似乎不起作用。白块的样式是由ScrollPane
控制的吗?
CSS:
/*******************************************************************************
* *
* ScrollPane *
* *
******************************************************************************/
.scroll-pane{
-fx-background-color: #30466B;
}
.scroll-pane > .viewport {
-fx-background-color: #30466B;
}
.scroll-pane > .scroll-bar:horizontal {
-fx-background-insets: 0 1 1 1, 1;
-fx-padding: 0 1 0 1;
-fx-background-color: #30466B;
}
.scroll-pane > .scroll-bar:horizontal > .increment-button,
.scroll-pane > .scroll-bar:horizontal > .decrement-button {
-fx-padding: 0.166667em 0.25em 0.25em 0.25em; /* 2 3 3 3 */
-fx-background-color: #30466B;
}
.scroll-pane > .scroll-bar:vertical > .increment-button,
.scroll-pane > .scroll-bar:vertical > .decrement-button {
-fx-padding: 0.25em 0.25em 0.25em 0.166667em; /* 3 3 3 2 */
-fx-background-color: #30466B;
}
.scroll-pane > .scroll-bar:vertical {
-fx-background-insets: 1 1 1 0, 1;
-fx-padding: 1 0 1 0;
-fx-background-color: #30466B;
}
.scroll-pane > .corner {
-fx-background-color: #30466B;
-fx-background-insets: 0 1 1 0;
}
/* new styleclass for edge to edge scrollpanes that don't want to draw a border */
.scroll-pane.edge-to-edge,
.tab-pane > * > .scroll-pane {
-fx-background-color: #30466B;
-fx-background-insets: 0;
-fx-padding: 0;
}
.scroll-pane.edge-to-edge > .scroll-bar,
.tab-pane > * > .scroll-pane > .scroll-bar,
.titled-pane > .content > .scroll-pane > .scroll-bar {
-fx-background-insets: 0;
-fx-padding: 0;
-fx-background-color: #30466B;
}
.scroll-pane.edge-to-edge > .scroll-bar > .increment-button,
.scroll-pane.edge-to-edge > .scroll-bar > .decrement-button,
.tab-pane > * > .scroll-pane > .scroll-bar > .increment-button,
.tab-pane > * > .scroll-pane > .scroll-bar > .decrement-button,
.titled-pane > .content > .scroll-pane > .scroll-bar > .increment-button,
.titled-pane > .content > .scroll-pane > .scroll-bar > .decrement-button {
-fx-padding: 0.25em; /* 3px */
-fx-background-color: #30466B;
}
角框使用 styleClass "corner" 定义。您需要为 tableView 覆盖以下 css 实现:
.table-view > .virtual-flow > .corner {
-fx-background-color: derive(-fx-base,-1%);
}
如图,问题出在table的右下角。我想将白色方块的颜色更改为蓝色,但我做不到。我尝试设置 ScrollPane
的样式,但它似乎不起作用。白块的样式是由ScrollPane
控制的吗?
CSS:
/*******************************************************************************
* *
* ScrollPane *
* *
******************************************************************************/
.scroll-pane{
-fx-background-color: #30466B;
}
.scroll-pane > .viewport {
-fx-background-color: #30466B;
}
.scroll-pane > .scroll-bar:horizontal {
-fx-background-insets: 0 1 1 1, 1;
-fx-padding: 0 1 0 1;
-fx-background-color: #30466B;
}
.scroll-pane > .scroll-bar:horizontal > .increment-button,
.scroll-pane > .scroll-bar:horizontal > .decrement-button {
-fx-padding: 0.166667em 0.25em 0.25em 0.25em; /* 2 3 3 3 */
-fx-background-color: #30466B;
}
.scroll-pane > .scroll-bar:vertical > .increment-button,
.scroll-pane > .scroll-bar:vertical > .decrement-button {
-fx-padding: 0.25em 0.25em 0.25em 0.166667em; /* 3 3 3 2 */
-fx-background-color: #30466B;
}
.scroll-pane > .scroll-bar:vertical {
-fx-background-insets: 1 1 1 0, 1;
-fx-padding: 1 0 1 0;
-fx-background-color: #30466B;
}
.scroll-pane > .corner {
-fx-background-color: #30466B;
-fx-background-insets: 0 1 1 0;
}
/* new styleclass for edge to edge scrollpanes that don't want to draw a border */
.scroll-pane.edge-to-edge,
.tab-pane > * > .scroll-pane {
-fx-background-color: #30466B;
-fx-background-insets: 0;
-fx-padding: 0;
}
.scroll-pane.edge-to-edge > .scroll-bar,
.tab-pane > * > .scroll-pane > .scroll-bar,
.titled-pane > .content > .scroll-pane > .scroll-bar {
-fx-background-insets: 0;
-fx-padding: 0;
-fx-background-color: #30466B;
}
.scroll-pane.edge-to-edge > .scroll-bar > .increment-button,
.scroll-pane.edge-to-edge > .scroll-bar > .decrement-button,
.tab-pane > * > .scroll-pane > .scroll-bar > .increment-button,
.tab-pane > * > .scroll-pane > .scroll-bar > .decrement-button,
.titled-pane > .content > .scroll-pane > .scroll-bar > .increment-button,
.titled-pane > .content > .scroll-pane > .scroll-bar > .decrement-button {
-fx-padding: 0.25em; /* 3px */
-fx-background-color: #30466B;
}
角框使用 styleClass "corner" 定义。您需要为 tableView 覆盖以下 css 实现:
.table-view > .virtual-flow > .corner {
-fx-background-color: derive(-fx-base,-1%);
}