G GarryP64 Member Jul 26, 2023 #1 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.
E emexes Expert Licensed User Longtime User Jul 27, 2023 #2 GarryP64 said: 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. Click to expand... Maybe a label will do the job: Upvote 0
GarryP64 said: 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. Click to expand... Maybe a label will do the job:
E emexes Expert Licensed User Longtime User Jul 27, 2023 #3 GarryP64 said: 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. Click to expand... emexes said: Maybe a label will do the job: Click to expand... or a textfield (but seemingly: not a textarea) Upvote 0
GarryP64 said: 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. Click to expand... emexes said: Maybe a label will do the job: Click to expand... or a textfield (but seemingly: not a textarea)
stevel05 Expert Licensed User Longtime User Jul 27, 2023 #4 You can do it with a stylesheet. 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 TextareaCenterText.zip TextareaCenterText.zip 2.4 KB · Views: 321 Last edited: Jul 27, 2023 Upvote 0
You can do it with a stylesheet. 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.