在 CSS (JavaFX) 中设置 TableView 样式
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33938811/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Styling a TableView in CSS (JavaFX)
提问by Chris
How can I style the "THIS" point in my TableView?
如何在 TableView 中设置“THIS”点的样式?
My CSS Code looks as follows:
我的 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;
}*
So as you can see I've already changed the colum-header-background and everything like this. Also I#ve changed the background of the TableView. So I really don't know what exactly I should change in my CSS. Thanks for every help! :)
正如你所看到的,我已经改变了 colum-header-background 和所有类似的东西。我也#ve 改变了TableView 的背景。所以我真的不知道我到底应该在我的 CSS 中改变什么。感谢您的每一个帮助!:)
-GhostfaceChilla-
-GhostfaceChilla-
采纳答案by wzberger
.table-view .filleris the selector you are looking for. The scenic view toolis pretty good for analyzing a component.
.table-view .filler是您正在寻找的选择器。在美景工具是用于分析组件还不错。
回答by Dmitrij Krupa
.table-view{
-fx-background-color: transparent;
}
Background color can be white if no records in TableView. And maybe nice to have styling for placeholder
如果 TableView 中没有记录,背景颜色可以是白色。可能很高兴为占位符设置样式
回答by Sushant
In case anyone came here searching for CSS of column-show-hide button, here is the CSS.
如果有人来这里搜索 column-show-hide 按钮的 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;
}
回答by Java_Albin
I managed to solve this with this CSS code:
我设法用这个 CSS 代码解决了这个问题:
.table-view .filler {
-fx-border-insets: 10 //Enter value depending on thickness;
}
回答by sandeep kumar sahoo
Try this
尝试这个
.table-view .filler{
-fx-background-color: transparent;
}