I have a JLabel, and as the JFrame window expands, the font size automatically changes. The text that is in the JLabel can either be abbreviated or put in full text like so:
Because I am using Eclipse's "AbsoluteLayout" for Swing (frame.getContentPane().setLayout(null)
), JLabels won't automatically resize to the size of the texts and are fixed values. Note that I do change those fixed values as the window changes size. I already have an algorithm for this.
Instead of doing a large calculation determining whether the window is large enough to display the un-abreviated text, I would like to know if there is a way to determine whether my text would appear like this:
If I could know that the text would be cut off (due to long text in a small JLabel), I could abbreviate the text, otherwise display it in full.
Is there any way to do what I'm asking while still using the AbsoluteLayout?
Note: It is necessary that I use AbsoluteLayout, so don't bother commenting about it even though it is typically regarded as bad practice.