I think it would be very convenient to have a .RunMethod method for every node. So we would need to create new variables as JavaObject when running external methods.
Current:
B4X:
Dim l As Label
l.Initialize("")
l.Text = "Blah"
Dim lJo As JavaObject = l
lJo.RunMethod("setRotate", Array(90.0))
Suggested:
B4X:
Dim l As Label
l.Initialize("")
l.Text = "Blah"
l.RunMethod("setRotate", Array(90.0))
Or:
B4X:
Dim l As Label
l.Initialize("")
l.Text = "Blah"
l.asJo.RunMethod("setRotate", Array(90.0))
I was thinking about a general way of calling any Javafx method, like setPrefWidth, setMinWidth, setGraphic etc... that doesn't exist in B4J
At the moment I use the asJo method by daestrum, which I find convenient enough. This idea I propose is just to make the code simpler and cleaner, nothing more
An all purpose sub - not quite what you wanted but flexible to allow for any method call
B4X:
...
Dim l As Label
l.Initialize("")
l.Text = "Hello"
MainForm.RootPane.AddNode(l,20,20,-1,-1)
RunMethod(l,"setRotate",Array(45.0))
End Sub
Sub RunMethod(n As JavaObject,method As String,args() As Object)
n.RunMethod(method,args)
End Sub
An all purpose sub - not quite what you wanted but flexible to allow for any method call
B4X:
...
Dim l As Label
l.Initialize("")
l.Text = "Hello"
MainForm.RootPane.AddNode(l,20,20,-1,-1)
RunMethod(l,"setRotate",Array(45.0))
End Sub
Sub RunMethod(n As JavaObject,method As String,args() As Object)
n.RunMethod(method,args)
End Sub