### Change TableRow Color CSS

To change the tablerow color depending on selection or hovered, create a CSS file, store in
Files folder and added to the project.
Example CSS File main.css
/* Selected row */
.table-view:focused .table-row-cell:filled:selected {
-fx-background-color: brown;
-fx-background-insets: 0, 1, 2;
-fx-background: -fx-accent;
-fx-text-fill: -fx-selection-bar-text;
}
/* Selected row when table not focused */
.table-row-cell:filled:focused:selected {
-fx-background-color: red;
-fx-background-insets: 0, 1, 2;
-fx-background: -fx-accent;
-fx-text-fill: -fx-selection-bar-text;
}
/* Row hovered */
.table-view:row-selection .table-row-cell:filled:hover {
-fx-background-color: green;
-fx-background-insets: 0, 0 0 1 0;
-fx-text-fill: -fx-text-inner-color;
}
/* Selected row hovered */
.table-view:focused .table-row-cell:filled:focused:selected:hover {
-fx-background: -fx-accent;
-fx-background-color: gray;
-fx-background-insets: 0, 1, 2;
-fx-text-fill: -fx-selection-bar-text;
}
/* Selected row hovered when table not focused */
.table-view:row-selection .table-row-cell:filled:focused:hover {
-fx-background-color: blue;
-fx-background-insets: 0, 0 0 1 0, 1 1 2 1, 2 2 3 2, 3 3 4 3;
-fx-text-fill: -fx-text-inner-color;
}
Add to project
In B4J code set the MainForm style - this style applies to all controls:
MainForm.Stylesheets.Add(File.GetUri(File.DirAssets, "main.css"))

Changed: , Category: TableView, File: T6C259M1874.htm, ID: 1874