Daniel Peñalba Daniel Peñalba - 8 months ago 55
Java Question

SWT label size is not correctly updated

I'm new in Java/SWT. I'm experiencing some troubles using a SWT label.

When I update the text on the label, its size is not correctly updated (the label is cut, respecting the original size). However, if I perform a very small resize in my dialog, the size is updated correctly.

Basically, I create the label with a default text and then, when I load data I update the label with the real text, that is bigger than the original one.

I tried calling

without luck.

Please, someone could help me with this issue?

Thanks in advance.

Answer Source

Try to call parent.layout(), where parent is the Composite which contains your label. Also see Understanding Layouts in SWT.