I am looking for an alternative to FontLoader.computeStringWidth, since this is a Class from the com.sun package and should not be used.
This is used to dynamically set the prefWidth based on text in order to consider text font size (which may come from CSS). Having multiple GridPane I want the first column to be aligned with all the grids.
For example
From this:
| Column1Text | Column2 |
| Column1TextMore | Column2 |
| Column1TextSomeMore | Column2 |
To this (disregard the dots):
| Column1Text .................| Column2 |
| Column1TextMore .........| Column2 |
| Column1TextSomeMore | Column2 |
I did find one accepted answer here which was to create a temporary Scene, add a Text to it, then call applyCss and finally get the width. However I did not like this alternative. Must be a better way. https://stackoverflow.com/a/13020490/1835477
In my case I have multiple grids, and creating a Scene/Text for each seems like a poor solution (performance wise) and not particularly elegant.