Friday, April 8, 2011

How can I make fonts resize with the window in Applet JLabel components?

As the question says... I can set the layout etc. up to resize with the window, but I've not worked out how to make the fonts resize.

(Actually it might be the JLabel components themselves that aren't resizing, and constraining the fonts...)

From stackoverflow
  • You would probably have to set up some kind of listener to track changes in the size of the window (or applet, or layout), and call either setFont() or setAffineTransform() to keep the size of the font synchronized.

    One of the reasons font rendering is done the way it is, is so that fonts can have a consistent size on different screen resolutions and layouts. The system isn't really meant to scale fonts with the layout.

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.