JavaFx TreeView单元格突出显示

时间:2016-04-24 03:48:01

标签: java css javafx

我试图在鼠标悬停时更改TreeRow的颜色,但如果将鼠标悬停在选定的行上,则不会突出显示部分行。

enter image description here

如果行已聚焦但未选中

,则有效

这是我的css规则

.table-row-cell {
    -fx-skin: "com.sun.javafx.scene.control.skin.TableRowSkin";
    -fx-background-insets: 0, 0 0 1 0;
    -fx-padding: 0.0em;
    /* 0 */
    -fx-text-fill: #fff;
    -fx-text-inner-color: #fff;
    -fx-background-color: #474747;
    -fx-table-cell-border-color: transparent;
    -fx-table-header-border-color: transparent;
}

.table-row-cell:focused {
    -fx-background-insets: 0, 1, 2;
    -fx-background-color: transparent;
    -fx-table-cell-border-color: transparent;
    -fx-table-header-border-color: transparent;
}

.table-view:focused .table-row-cell:filled:selected .table-cell {
    -fx-background-color: #6a6a6a;
    -fx-text-fill: #fff;
}


/* When the TableView is _not_ focused, we show alternate selection colors */

.table-row-cell:filled:selected:focused,
.table-row-cell:filled:selected {
    -fx-background-color: #6a6a6a;
}

.table-view:row-selection .table-row-cell:filled:hover {
    -fx-background-color: #e84c3d;
    -fx-background-insets: 0, 0 0 1 0;
    /*-fx-text-fill: -fx-text-inner-color;*/
    -fx-text-fill: #fff;
    -fx-table-cell-border-color: transparent;
    -fx-table-header-border-color: transparent;
}

.table-view:row-selection .table-row-cell:filled:focused:hover {
    -fx-background-color: #e84c3d;
    /*-fx-text-fill: -fx-text-inner-color;*/
    -fx-text-fill: #fff;
    -fx-table-cell-border-color: #9f9f9f;
    -fx-table-header-border-color: #9f9f9f;
}

.table-view:focused .table-row-cell:filled:selected .table-cell:hover {
    -fx-background-color: #e84c3d;
    /*-fx-text-fill: -fx-text-inner-color;*/
    -fx-text-fill: #fff;
    -fx-table-cell-border-color: transparent;
    -fx-table-header-border-color: transparent;
}

0 个答案:

没有答案