### StyleClass change Style JavaObject

This is an option to change the style of a styleclass.
Use a JavaObject two API methods:
1. Assign the ProgressBar to the JavaObject. This becomes the Node.
2. Lookup for the first sub-node for the given CSS selector (idc .bar)
3. Change the style of the node found
Example for a ProgressBar
'Set the color of progressbar
'Parameter: ProgressBar, Color as string
'Examples:
'Private pbMain as ProgressBar
'setProgressBarColor(pbMain, "red")
'setProgressBarColor(pbMain, "green")
`Sub setProgressBarColor(pb As ProgressBar, color As String)
Dim joPB As JavaObject = pb
joPB.RunMethodJo("lookup", Array(".bar")).RunMethod("setStyle", Array("-fx-background-color: " & color & ";"))
'Call without parameter: joPB.RunMethodJo("lookup", Array(".bar")).RunMethod("setStyle", Array("-fx-background-color: red;"))
End Sub`
Note
CSS defined in caspian.css as .progress-bar > .bar {-fx-background-color: red;}
whereas: Node = .progress-bar, Sub-Node = .bar, Style = {-fx...}
See: http://docs.oracle.com/javafx/2/api/javafx/scene/doc-files/cssref.html#progressbar

Changed: 2018-05-10 17:52, Category: CSS, File: T6C177M1293.htm, ID: 1293