'Parent - The Node that ontains a scrollbar i.e. ListView, TableView etc.
'Orientation - can be VERTICAL, HORIZONTAL or BOTH
'Size - The required width for a VERTICAl scrollbar or height for a HORIZONTAL scroll bar
Public Sub SetScrollbarSize(Parent As JavaObject, Orientation As String, Size As Double)
'Get a Set that contains the scrollbars attached to the parent and convert it to an array
Dim Arr() As Object = Parent.RunMethodJO("lookupAll",Array(".scroll-bar")).RunMethod("toArray",Null)
For Each N As Node In Arr
'Check this object is a scrolbar
If GetType(N) = "com.sun.javafx.scene.control.skin.VirtualScrollBar" Or GetType(N) = "javafx.scene.control.ScrollBar" Then
Dim SB As JavaObject = N
'Get the orientation of the scrollbar as a string
Dim BarOrientation As String = SB.RunMethodJO("getOrientation",Null).RunMethod("toString",Null)
'Required Orientation is VERTICAL or BOTH
If BarOrientation = "VERTICAL" And (Orientation = BarOrientation Or Orientation = "BOTH") Then
N.PrefWidth = Size
End If
'Required Orientation is HORIZONTAL or BOTH
If BarOrientation = "HORIZONTAL" And (Orientation = BarOrientation Or Orientation = "BOTH") Then
N.PrefHeight = Size
End If
End If
Next
End Sub