Search code examples
javacssjavafxjavafx-8treetableview

JavaFx: TreeTableCell border css


I am trying to style my cells in a TreeTableView but something I cannot figure out how to implement.

I want different colors for the right-left border and for the top-bottom, but that way the right-left(those lines which separate the columns) to be on the "top". I will show it with an image what I mean.

enter image description here

I want that the red line to be continuous rather than the blue one. As you can see the red lines are interrupted by the blue ones.

Here is the code part which is relevant:

.tree-table-cell{
    -fx-border-width: 0 5 1 0;
    -fx-border-color: transparent red blue transparent;
}

How can I achieve that the red lines to be continuous and the blue ones to be "dashed"?


Solution

  • You're currently using one border stroke with different colors for each side. Apparently, the bottom side is drawn on top of the right side. I'm not sure if there's a way to fix this using only one border stroke, but using multiple border strokes can do what you want.

    .tree-table-cell {
        -fx-border-color: blue, red;
        -fx-border-width: 0 0 1 0, 0 5 0 0;
    }
    

    The commas (,) separate each border stroke and width where each width applies to the corresponding stroke, as documented by the JavaFX CSS Reference Guide (in the Available CSS Properties table for Region).