B4J Question How to set underline for TextField

cxbs

Active Member
Licensed User
Longtime User
Hello everyone!

I am a beginner at B4J

I have set the TextField font size

But the “-fx-underline:true ;” underline set is not displayed

How should I set it up?

Thank you in advance!

B4X:
#Region Project Attributes
    #MainFormWidth: 600
    #MainFormHeight: 600
#End Region

Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
    Private xui As XUI
    Private Button1 As B4XView
    Private TextField1 As TextField
End Sub

Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.RootPane.LoadLayout("Layout1")
    MainForm.Show
End Sub

Sub Button1_Click
    'xui.MsgboxAsync("Hello World!", "B4X")
    TextField1.Style="-fx-font-size:30;-fx-font-weight:bold;-fx-underline:true;"  '-fx-underline:true  is not displayed
    TextField1.Text ="ABC123"
End Sub
 

Attachments

  • underline.zip
    2.1 KB · Views: 51
Last edited:

teddybear

Well-Known Member
Licensed User
Hello everyone!

I am a beginner at B4J

I have set the TextField font size

But the “-fx-underline:true ;” underline set is not displayed

How should I set it up?

Thank you in advance!

B4X:
#Region Project Attributes
    #MainFormWidth: 600
    #MainFormHeight: 600
#End Region

Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
    Private xui As XUI
    Private Button1 As B4XView
    Private TextField1 As TextField
End Sub

Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.RootPane.LoadLayout("Layout1")
    MainForm.Show
End Sub

Sub Button1_Click
    'xui.MsgboxAsync("Hello World!", "B4X")
    TextField1.Style="-fx-font-size:30;-fx-font-weight:bold;-fx-underline:true;"  '-fx-underline:true  is not displayed
    TextField1.Text ="ABC123"
End Sub
1.Add style.css
CSS:
#textfield .text {
    -fx-underline: true ;
}
2. b4xCode
B4X:
Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.RootPane.LoadLayout("Layout1")
    MainForm.Stylesheets.Add(File.GetUri(File.DirAssets, "style.css"))  'Added style.css
    MainForm.Show
End Sub

Sub Button1_Click
    'xui.MsgboxAsync("Hello World!", "B4X")
    TextField1.Style="-fx-font-size:30;-fx-font-weight:bold;" 
    TextField1.Id="textfield"    'Set node id
    TextField1.Text ="ABC123"
End Sub
 
Upvote 0

cxbs

Active Member
Licensed User
Longtime User
1.Add style.css
CSS:
#textfield .text {
    -fx-underline: true ;
}
2. b4xCode
B4X:
Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.RootPane.LoadLayout("Layout1")
    MainForm.Stylesheets.Add(File.GetUri(File.DirAssets, "style.css"))  'Added style.css
    MainForm.Show
End Sub

Sub Button1_Click
    'xui.MsgboxAsync("Hello World!", "B4X")
    TextField1.Style="-fx-font-size:30;-fx-font-weight:bold;"
    TextField1.Id="textfield"    'Set node id
    TextField1.Text ="ABC123"
End Sub
Thank you very much for providing the solution!
 
Upvote 0
Top