B4J Question Spacing between lines of text in a TextArea

Johan Schoeman

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

    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?


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:
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


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

'how use
frm.Stylesheets.Add(File.GetUri(File.DirAssets, "mycss.css"))
Upvote 0