B4J Question Center text

GarryP64

Member
B4J noob question:
is there a way to center text in a textarea or textfield? I want a display for temperature that could be 4 or 5 digits long with the decimal point and it would look much better if centered.
 
B4J noob question:
is there a way to center text in a textarea or textfield? I want a display for temperature that could be 4 or 5 digits long with the decimal point and it would look much better if centered.

Maybe a label will do the job:

1690434934857.png
 
Upvote 0
You can do it with a stylesheet.

1690461755694.png

B4X: Copy
.centered-text-area .text {
    -fx-text-alignment: center;
}

and add a StyleClass to the Textarea
B4X: Copy
TextArea1.As(Node).StyleClasses.Add("centered-text-area")

Project with stylesheet is attached if needed.
 

Attachments

Last edited:
Upvote 0
Back
Top