SWT 标签大小未正确更新 [英] SWT label size is not correctly updated
问题描述
我是 Java/SWT 新手.我在使用 SWT 标签.
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.
我尝试调用 label.update()
和 label.redraw()
没有运气.
I tried calling label.update()
and label.redraw()
without luck.
推荐答案
尝试调用parent.layout()
,其中parent
是Composite
代码> 包含您的标签.另请参阅了解 SWT 中的布局.
Try to call parent.layout()
, where parent
is the Composite
which contains your label. Also see Understanding Layouts in SWT.
这篇关于SWT 标签大小未正确更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!