Css 如何在JavaFX中删除TableView标题中的边框

Css 如何在JavaFX中删除TableView标题中的边框,css,javafx,tableview,Css,Javafx,Tableview,我在javaFX应用程序的许多地方使用TableView。我正在做一个黑暗模式的主题,想设计这个桌子。现在我无法删除标题行中的边框。此外,表格行中的文本颜色仍为黑色,尽管其余文本显示为白色,因为在我的应用程序中,根css类中的-fx base颜色为深色。该表如下所示: css: .root { -fx-base:#292929; } .table-view { -fx-background-color: transparent; -fx-border-color: all-dial

我在javaFX应用程序的许多地方使用TableView。我正在做一个黑暗模式的主题,想设计这个桌子。现在我无法删除标题行中的边框。此外,表格行中的文本颜色仍为黑色,尽管其余文本显示为白色,因为在我的应用程序中,根css类中的-fx base颜色为深色。该表如下所示:

css:

.root {
-fx-base:#292929;
}

.table-view {
   -fx-background-color: transparent;
   -fx-border-color: all-dialog-border-color;
   -fx-border-width: 1;
   -fx-table-header-border-color: transparent;
   -fx-table-cell-border-color: transparent;
   -fx-text-fill: white;
}

.table-view .column-header-background
{
   -fx-background-color: -fx-base;
}

.table-row-cell
{
    -fx-background-insets: 0, 0 0 1 0;
    -fx-background-color: transparent;
    -fx-text-fill: white;
}
.table-column {
  -fx-alignment: CENTER;
}

.table-view:focused .table-row-cell:focused {
    -fx-table-cell-border-color: transparent;
}

我想删除标题中各列之间的边框,并使表格行中的文本显示为白色。如何实现这一点?

只需使用此Css,它将为您提供所需的所有定制

.table-view{
    -fx-background-color: white;
    -fx-font-size: 20px;
    -fx-border-color: derive(black, -60%);
}
.table-view:focused{
    -fx-background-color: derive(-fx-primary, 20%);
}
.table-row-cell {
    -fx-cell-size: 40px;
    -fx-border-style:solid inside;
     -fx-border-width:2;
}
.table-view .column-header-background{
    -fx-background-color: white;
}
.table-view .column-header-background .label{
    -fx-background-color: transparent;
    -fx-text-fill: black;
    -fx-text-weight:strong;
    -fx-border-style:solid inside;
    -fx-border-width:2;
    -fx-border-radius:20;
    -fx-padding:7;
    -fx-font-size:18;
 }
.table-view .column-header {
    -fx-background-color: transparent;
 }
.table-view .table-cell{
    -fx-text-fill: black;
    -fx-font-size:15;
    -fx-alignment:center;
    -fx-border-style:solid inside;
    -fx-border-width:1;
}

.table-row-cell:focused, .table-cell:focused{
    -fx-text-fill: red;
}
.table-row-cell{
    -fx-background-color: -fx-primary;
    -fx-border-color: black;
    -fx-table-cell-border-color: transparent;
 }

.table-row-cell:empty{
    -fx-background-color:white;
    -fx-border-color: transparent;
    -fx-table-cell-border-color: transparent;
 }

.table-column{
    -fx-alignment: CENTER;
 }
.table-row-cell:even{
    -fx-background-color: derive(white, -10%);
 }
.table-row-cell:odd{
     -fx-background-color: white;
 }
 .table-row-cell:even:hover{
     -fx-background-color:pink;
 }
 .table-row-cell:odd:hover{
    -fx-background-color: skyblue;
 }

.table-row-cell:even:empty{
    -fx-background-color: white;
}
.table-row-cell:odd:empty{
    -fx-background-color: white;
}

.table-row-cell:selected {
    -fx-background-color: black;
    -fx-text-fill: white;
    -fx-background-insets: 0;
 }
.table-row-cell:selected .table-cell{
    -fx-text-fill: white;
 }
在浏览了Tule Simon建议的TableView css之后,我意识到缺少了一些css类。 要从表格标题中删除边框,请使用:

.table-view .column-header
{
   -fx-border-style: none;
}
要使单元格中的文本显示为白色,请执行以下操作:

.table-cell
{
    -fx-text-fill: white;
}
结果:


你的回答没有明确针对我问题中的问题,你分享了整个表格。我希望有人能发现我的css中的错误,并指出应该修改的地方。在经历了所有这些之后,我发现了css中的不足之处。你的答案很有帮助,所以+1,但不具体,所以我将发布主要答案,以便下次有人碰到这个问题时,他们可以轻松确定解决方案,而不是通过所有css。谢谢你的回答。谢谢。我可以指出,但是你的css有太多未指定的值。。。所以我特意发布了整个定制css,这样你就可以得到你所需要的一切,甚至可以添加更多的定制。我的css非常小,错误会更容易识别。如果我想要完全定制,我会搜索它,但我想知道哪里出错了。既然你说你是故意贴出来的,我会给你,并接受你的回答,因为你的回答很有帮助,但下次请更具体一些。