Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private tab1 As TableView
Private js As jScriptEngine ' need to add this to libs
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("tabres1") 'Load the layout file.
tab1.SetColumns(Array As String("One","Two","Three"))
MainForm.Show
js.enginePut("tab1",tab1)
js.evalString("tab1.setColumnResizePolicy(tab1.CONSTRAINED_RESIZE_POLICY);")
End Sub
Dim JO As JavaObject = Tab1
Dim Policy As JavaObject
Policy = Policy.InitializeStatic("javafx.scene.control.TableView").GetField("CONSTRAINED_RESIZE_POLICY")
JO.RunMethod("setColumnResizePolicy",Array As Object(Policy))
Nice find
You can also apply it using JavaObject
B4X:Dim JO As JavaObject = Tab1 Dim Policy As JavaObject Policy = Policy.InitializeStatic("javafx.scene.control.TableView").GetField("CONSTRAINED_RESIZE_POLICY") JO.RunMethod("setColumnResizePolicy",Array As Object(Policy))
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private Tab1 As TableView
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("1") 'Load the layout file.
Dim JO As JavaObject = Tab1 'Tab1 is a TableView defined in layout "1"
Dim Policy As JavaObject
Policy = Policy.InitializeStatic("javafx.scene.control.TableView").GetField("CONSTRAINED_RESIZE_POLICY")
JO.RunMethod("setColumnResizePolicy",Array As Object(Policy))
MainForm.Show
End Sub
Something like this:
B4X:Sub Process_Globals Private fx As JFX Private MainForm As Form Private Tab1 As TableView End Sub Sub AppStart (Form1 As Form, Args() As String) MainForm = Form1 MainForm.RootPane.LoadLayout("1") 'Load the layout file. Dim JO As JavaObject = Tab1 'Tab1 is a TableView defined in layout "1" Dim Policy As JavaObject Policy = Policy.InitializeStatic("javafx.scene.control.TableView").GetField("CONSTRAINED_RESIZE_POLICY") JO.RunMethod("setColumnResizePolicy",Array As Object(Policy)) MainForm.Show End Sub