### Set CSS Style Visual Designer

To set the CSS style of a TableView, an option is to make use of an external CSS file.
This example defines two TableView Styles tableview1 and tableview2.
CSS Style File Main.css
Place the CSS Style file in the dir assets folder of the project (Files folder).
The file must be added to the B4J IDE Files Manager.
Note the space between the class and the method.
.tableview1 .table-row-cell:odd {
-fx-background-color:yellow;
}
.tableview1 .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
}
.tableview1 .table-cell:selected {
-fx-font-family: "Segoe UI Semibold";
-fx-text-fill: white;
-fx-background-color: blue
}
.tableview2 .table-row-cell:odd {
-fx-background-color:green
}
.tableview2 .table-row-cell:filled:focused:selected {
-fx-background-color: blue;
-fx-background-insets: 0, 1, 2;
-fx-background: -fx-accent;
-fx-text-fill: -fx-selection-bar-text
}
.tableview2 .table-cell:selected {
-fx-font-family: "Segoe UI Semibold";
-fx-text-fill: white;
-fx-background-color: blue
}
B4J Code
Define the TableViews:
`Sub Process_Globals
Private MainForm As Form
Private TableView1 As TableView
Private TableView2 As TableView
End Sub`
Assign the Stylesheet to the MainForm RootPane:
Ensure to use the exact syntax for the CSS file name. The file must be added to the B4J IDE Files Manager.
`Sub AppStart (Form1 As Form, Args() As String)
...
MainForm.Stylesheets.Add(File.GetUri(File.DirAssets, "Main.css"))
...
Assign the styles to the TableViews.
TableView1.StyleClasses.Add("tableview1")
TableView2.StyleClasses.Add("tableview2")
End Sub`

Changed: , Category: TableView, File: T6C259M1902.htm, ID: 1902