Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the size of the font of a Label to take the maximum size

Tags:

javafx-2

I have a Label in a Scene. I need to get always the largest font size for the text in it, so that the text always takes the maximum size in the available size of the label.

How can I do that?

like image 754
rbs Avatar asked Nov 21 '12 12:11

rbs


1 Answers

final double MAX_FONT_SIZE = 30.0; // define max font size you need
label.setFont(new Font(MAX_FONT_SIZE)); // set to Label
like image 53
invariant Avatar answered Sep 28 '22 07:09

invariant