B4J Question Create a password field by code

Discussion in 'B4J Questions' started by RUdolf Lam, Feb 8, 2015.

  1. RUdolf Lam

    RUdolf Lam New Member

    How could I create a password field by code (but not using the JavaFx Scene builder)?
    Thank you.
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Here:
    Code:
    Sub AppStart (Form1 As Form, Args() As String)
       MainForm = Form1
       MainForm.Show
       
    Dim tf As TextField = CreatePasswordField
       MainForm.RootPane.AddNode(tf, 
    0010050)
    End Sub

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

    RUdolf Lam New Member

    Thank you very much!
    I've searched the forum for the whole night and could not find any hints.
     
  4. RUdolf Lam

    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)
     
  5. Erel

    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).
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice