开发者

SWT: How to get the default (preferred) size of a Control

An SWT component only has a getSize() method. It returns the actual size of this control. But how to get the default size of a component, especially if a different one already has been 开发者_如何学Goset before?


You can obtain the default size by calling computeSize(SWT.DEFAULT, SWT.DEFAULT) on your widget. You may pass a default height or width instead of SWT.DEFAULT in cases such as a multiline Label, where you'd want to know its natural height given a maximum line width, for instance.

For all standard widgets, computeSize disregard the value passed in any previous setSize calls.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜