0

pretty basic question but I couldn't figure out how to do it. In javafx I can use xProperty() and yProperty() to bind my text to the pane but when I do this it doesn't change the size of the text. Anybody know how to make it so the text resizes as the size of the window its in changes? Thanks

Ryan Foster
  • 103
  • 9
  • You could increase the font size. Or you could, maybe, do this by scaling (using either transforms or `scaleX` and `scaleY` properties) the text node as the parent increases/decreases in size? – Slaw Jun 08 '18 at 00:20
  • I tried binding scaleX and scaleY to the parent and it did not work. And what do you mean by increase the font size. The entire point of doing this is to make it dynamic so it changes with the window – Ryan Foster Jun 08 '18 at 00:33
  • I just meant change the font size as the window changes size. I have no idea how to do it (or if it's even possible, especially in a cross-platform or cross-display way). As for scaling, it would require doing some math to make sure the text-width-to-parent-width ratio and text-height-to-parent-height ratio are constant. Again, I haven't really thought about how to implement it but the idea popped into my head and I mentioned it in the hopes of inspiring you or someone else. – Slaw Jun 08 '18 at 00:39
  • Have a look here : https://stackoverflow.com/questions/23705654/bind-font-size-in-javafx – JKostikiadis Jun 08 '18 at 00:43

0 Answers0