Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private TableView1 As TableView
Private HorizontalScrollBar As JavaObject
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("1") 'Load the layout file.
MainForm.Show
TableView1.SetColumns(Array("a", "b", "c", "d", "e"))
TableView1.SingleCellSelection = True
For i = 1 To 1000
TableView1.Items.Add(Array(i, i, i, i, i))
Next
HorizontalScrollBar = FindHorizontalScrollBar(TableView1)
Log(HorizontalScrollBar)
End Sub
Sub FindHorizontalScrollBar (tv As TableView) As JavaObject
Dim jo As JavaObject = tv
Dim bars() As Object = jo.RunMethodJO("lookupAll", Array(".scroll-bar")).RunMethod("toArray", Null)
For Each bar As JavaObject In bars
Dim orientation As String = bar.RunMethod("getOrientation", Null)
If orientation = "HORIZONTAL" Then
Return bar
End If
Next
Return Null
End Sub
Sub MainForm_MouseClicked (EventData As MouseEvent)
Dim MinValue As Double = HorizontalScrollBar.RunMethod("getMin", Null)
Dim MaxValue As Double = HorizontalScrollBar.RunMethod("getMax", Null)
Dim value As Double = (MinValue + MaxValue) / 2 'must be double
HorizontalScrollBar.RunMethod("setValue", Array(value))
End Sub