JavaFX: Show grid lines of TreeTableView








  • Save the following to resources/MyApp.css:
    .tree-table-row-cell {
        -fx-background-color: -fx-table-cell-border-color, -fx-control-inner-background;
        -fx-background-insets: 0, 0 0 1 0;
        -fx-padding: 0.0em;
        -fx-text-fill: -fx-text-inner-color;
    }
    .tree-table-row-cell:selected {
        -fx-background-color: -fx-focus-color, -fx-cell-focus-inner-border, -fx-focus-color;
        -fx-background-insets: 0, 1, 2;
    }
    
    .tree-table-row-cell:odd {
        -fx-background-color: -fx-table-cell-border-color, derive(-fx-control-inner-background,-5%);
        -fx-background-insets: 0, 0 0 1 0;
    }
    
    .tree-table-row-cell:selected:odd {
        -fx-background-color: -fx-focus-color, -fx-cell-focus-inner-border, -fx-focus-color;
        -fx-background-insets: 0, 1, 2;
    }
    
  • In your Java class, add the css to a scene.
    String css = getClass().getResource("/resources/MyApp.css").toExternalForm();
    scene.getStyleSheets().add(getClass().getResource(cs);
    



No comments:

Post a Comment