【问题标题】:How do I change the border lines COLOUR on the table view如何更改表格视图上的边框线颜色
【发布时间】:2017-01-03 10:34:50
【问题描述】:

我已经尝试过 Remove grid line in tableView 中的以下代码,但这仅允许我更改垂直线颜色而不是水平线颜色。

所以,我正在尝试更改您在下图中看到的白色边框线颜色,我将如何更改此颜色?我正在使用带有 CSS 的 JavaFX。

这是我的 CSS:

.table-view{
    -fx-background-color: transparent;
}

.table-view:focused{
    -fx-background-color: transparent;
}

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

.table-view .column-header-background .label{
    -fx-background-color: transparent;
    -fx-text-fill: #0ed9e0;
}

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

.table-view .table-cell{
    -fx-text-fill: #0ed9e0;
    -fx-alignment: center;
}

.table-row-cell{
    -fx-background-color: -fx-table-cell-border-color, #2b2a2a;
    -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, #262626;
    -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;
}

【问题讨论】:

  • @Jan 这个问题是在我发表评论后由 OP 编辑​​的,以包含我建议的链接。尽管如此,它不再相关,我会删除评论。

标签: java css javafx


【解决方案1】:

要更改边框的垂直和水平颜色,您可以在 css 中使用以下代码:

.table-row-cell{
-fx-border-color: red;
-fx-table-cell-border-color:red;}

另外,您可以使用以下代码更改整个表格的边框(不是内边框):

.table-view{
-fx-border-color: red;}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-09-03
    • 2016-02-11
    • 2018-01-26
    • 1970-01-01
    • 2016-06-15
    • 2010-12-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多