B4J Question Create a password field by code

Erel

Administrator
Staff member
Licensed User
Here:
B4X:
Sub AppStart (Form1 As Form, Args() As String)
   MainForm = Form1
   MainForm.Show
   Dim tf As TextField = CreatePasswordField
   MainForm.RootPane.AddNode(tf, 0, 0, 100, 50)
End Sub

Sub CreatePasswordField As TextField
   Dim jo As JavaObject
   jo.InitializeNewInstance("javafx.scene.control.PasswordField", Null)
   Return jo
End Sub
 

RUdolf Lam

New Member
I've successfully added a textfield with password property.
But how could I add an event to this node e.g. Action / Mouseclicked etc.
(Because the textfield is not initialized as in the usual simple way so I could not assign an eventname to it)
 

Erel

Administrator
Staff member
Licensed User
This is true. If you need to add the events then you should load it from a layout file. You can create a layout file with only this field and load it (one or more times).
 
Top