在 CSS 中设置 TableView 的样式 (JavaFX)
Styling a TableView in CSS (JavaFX)
如何设置 TableView 中 "THIS" 点的样式?
我的 CSS 代码如下所示:
*/*
* Empty Stylesheet file.
*/
.root{
-fx-background-color: #262626;
}
.table-view{
-fx-background-color: transparent;
}
.table-view:focused{
-fx-background-color: transparent;
}
/* Spaltenköpfe
Struktur column-header-background -> column-header */
.table-view .column-header-background{
-fx-background-color: linear-gradient(#131313 0%, #424141 100%);
}
.table-view .column-header-background .label{
-fx-background-color: transparent;
-fx-text-fill: white;
}
.table-view .column-header {
-fx-background-color: transparent;
}
.table-view .table-cell{
-fx-text-fill: white;
}
.table-row-cell{
-fx-background-color: -fx-table-cell-border-color, #616161;
-fx-background-insets: 0, 0 0 1 0;
-fx-padding: 0.0em; /* 0 */
}
.table-row-cell:odd{
-fx-background-color: -fx-table-cell-border-color, #424242;
-fx-background-insets: 0, 0 0 1 0;
-fx-padding: 0.0em; /* 0 */
}
.table-row-cell:selected {
-fx-background-color: #005797;
-fx-background-insets: 0;
-fx-background-radius: 1;
}
.table-view > .virtual-flow > .scroll-bar:vertical,
.table-view > .virtual-flow > .scroll-bar:vertical > .track,
.table-view > .virtual-flow > .scroll-bar:vertical > .track-background,
.table-view > .virtual-flow > .scroll-bar:horizontal,
.table-view > .virtual-flow > .scroll-bar:horizontal > .track,
.table-view > .virtual-flow > .scroll-bar:horizontal > .track-background {
-fx-background-color: transparent;
}
.table-view > .virtual-flow > .scroll-bar > .increment-button,
.table-view > .virtual-flow > .scroll-bar > .decrement-button {
-fx-opacity: 0;
}*
如您所见,我已经更改了colum-header-background 和类似的所有内容。我还更改了 TableView 的背景。所以我真的不知道我应该在 CSS 中更改什么。
感谢您的帮助! :)
-GhostfaceChilla-
.table-view .filler 是您正在寻找的选择器。 scenic view tool 非常适合分析组件。
.table-view{
-fx-background-color: transparent;
}
如果TableView中没有记录,背景颜色可以是白色。也许很高兴为占位符设置样式
万一有人来这里搜索 CSS 列-显示-隐藏按钮,这里是 CSS。
.table-view .show-hide-columns-button {
-fx-background-color: red;
-fx-border-color: -fx-box-border;
-fx-border-insets: -1 -1 0 0;
}
我设法用这个 CSS 代码解决了这个问题:
.table-view .filler {
-fx-border-insets: 10 //Enter value depending on thickness;
}
试试这个
.table-view .filler{
-fx-background-color: transparent;
}
试试这个。
.table-view .column-header-background
{
-fx-background-color: transparent;
}
如何设置 TableView 中 "THIS" 点的样式?
我的 CSS 代码如下所示:
*/*
* Empty Stylesheet file.
*/
.root{
-fx-background-color: #262626;
}
.table-view{
-fx-background-color: transparent;
}
.table-view:focused{
-fx-background-color: transparent;
}
/* Spaltenköpfe
Struktur column-header-background -> column-header */
.table-view .column-header-background{
-fx-background-color: linear-gradient(#131313 0%, #424141 100%);
}
.table-view .column-header-background .label{
-fx-background-color: transparent;
-fx-text-fill: white;
}
.table-view .column-header {
-fx-background-color: transparent;
}
.table-view .table-cell{
-fx-text-fill: white;
}
.table-row-cell{
-fx-background-color: -fx-table-cell-border-color, #616161;
-fx-background-insets: 0, 0 0 1 0;
-fx-padding: 0.0em; /* 0 */
}
.table-row-cell:odd{
-fx-background-color: -fx-table-cell-border-color, #424242;
-fx-background-insets: 0, 0 0 1 0;
-fx-padding: 0.0em; /* 0 */
}
.table-row-cell:selected {
-fx-background-color: #005797;
-fx-background-insets: 0;
-fx-background-radius: 1;
}
.table-view > .virtual-flow > .scroll-bar:vertical,
.table-view > .virtual-flow > .scroll-bar:vertical > .track,
.table-view > .virtual-flow > .scroll-bar:vertical > .track-background,
.table-view > .virtual-flow > .scroll-bar:horizontal,
.table-view > .virtual-flow > .scroll-bar:horizontal > .track,
.table-view > .virtual-flow > .scroll-bar:horizontal > .track-background {
-fx-background-color: transparent;
}
.table-view > .virtual-flow > .scroll-bar > .increment-button,
.table-view > .virtual-flow > .scroll-bar > .decrement-button {
-fx-opacity: 0;
}*
如您所见,我已经更改了colum-header-background 和类似的所有内容。我还更改了 TableView 的背景。所以我真的不知道我应该在 CSS 中更改什么。 感谢您的帮助! :)
-GhostfaceChilla-
.table-view .filler 是您正在寻找的选择器。 scenic view tool 非常适合分析组件。
.table-view{
-fx-background-color: transparent;
}
如果TableView中没有记录,背景颜色可以是白色。也许很高兴为占位符设置样式
万一有人来这里搜索 CSS 列-显示-隐藏按钮,这里是 CSS。
.table-view .show-hide-columns-button {
-fx-background-color: red;
-fx-border-color: -fx-box-border;
-fx-border-insets: -1 -1 0 0;
}
我设法用这个 CSS 代码解决了这个问题:
.table-view .filler {
-fx-border-insets: 10 //Enter value depending on thickness;
}
试试这个
.table-view .filler{
-fx-background-color: transparent;
}
试试这个。
.table-view .column-header-background
{
-fx-background-color: transparent;
}