I tried -2, label not showing its text, and If I retrieve label height after that it returns -2.
But the first method using the string utils works, but that works only after adding label to panel with setting height as some other value, then calculting actual height and changing it.
Hi gkumar,
You say that -2 doesn't work, but you didn't say what you have done.
The attached test program shows that it does work.
That's what -2 (WRAP_CONTENT) is made for.