B4J Question Spacing between lines of text in a TextArea

Johan Schoeman

Expert
Licensed User
Longtime User
Part of the code that I am using in a TextArea is...

B4X:
    ta1.Style = "-fx-font-family: monospace;"
    ta1.Style = "-fx-font-weight: bolder;"   
    ta1.Style = "-fx-font-style: normal;"

Is there a way to increase or decrease the spacing between consecutive lines of text in a TextArea?
 

Roycefer

Well-Known Member
Licensed User
Longtime User
Each line in your code snippet is overriding the previous line. I suspect you want to be concatenating those Strings (if you want all that CSS applied to the TextArea, not just the last line) as follows:
B4X:
ta1.Style = ta1.Style & "-fx-font-family: monospace;"
ta1.Style = ta1.Style & "-fx-font-weight: bolder;" 
ta1.Style = ta1.Style & "-fx-font-style: normal;"

This is the full JavaFX CSS reference: https://docs.oracle.com/javafx/2/api/javafx/scene/doc-files/cssref.html . If what you want can't be found in there, it probably can't be found. Pay special attention to the stuff that various Nodes inherit from other Nodes. You might have to check a Node's ancestors to find for what you are looking.
 
Upvote 0

behnam_tr

Active Member
Licensed User
Longtime User
B4X:
.text-area .text {
     -fx-line-spacing: 10px;
}

'how use
frm.Stylesheets.Add(File.GetUri(File.DirAssets, "mycss.css"))
'or
CSSUtils.SetStyleProperty(TextArea1,"-fx-line-spacing","20px")
 
Upvote 0
Top