B4J Question JavaFX CSS

LucaMs

Expert
Licensed User
Longtime User
I read something about CSS listlessly few thousand years ago, so I only know their purpose.

Now, to use B4J, they are practically necessary.

I suppose JavaFX CSS is an implementation of CSS, since I found a small utility that creates CSS code but this code does not work when copied as it is.

Forgive my verbosity:

how can I get the bold, for example?

From this guide: JavaFX CSS Reference Guide:

<font-weight> The font's weight, using the following syntax:
[ normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 ]

...
-fx-font-size <font-size> inherit
-fx-font-weight <font-weight> inherit


I tried using both:
B4X:
mlblTitle.Style = "-fx-font-weight:bold"
B4X:
mlblTitle.Style = "-fx-font-weight: bold"

they do not work (but
B4X:
mlblTitle.Style = "-fx-font-size:18"
works fine)

How should I behave, generally in B4J, with CSS?

Thank you in advance
 
Last edited:

stevel05

Expert
Licensed User
Longtime User
B4X:
mlblTitle.Style="-fx-font-weight:bold;"
works for me with or without the trailing ';'

if you are adding more than 1 style using the style method, they need to be added at the same time, or only the last one will take effect i.e.

B4X:
mlblTitle.Style="-fx-font-weight:bold;-fx-font-size:18;"
 
Upvote 0
Top