If I new a LabelField like this:
LabelField label = new LabelField("long longgggg long text");
it shows:
-----------------------
| long longggg |
| long text |
-----------------------
if I use label.getWidth(), it gives the width of:
| long longggg |
but what I need is the width of:
| long longggg
Any solution?
Here is the method I use to get real height of label with multiple lines:
It goes through words one by one and calculates advance, trying to find out how much lines our label really uses. Then I use getFont().getHeight() to determine total height.
You can use the part that calculates advance from my example to get the real width of the label. To do that you can use Math.max() method to determine maximum line width.