开发者

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

开发者 https://www.devze.com 2023-01-29 16:31 出处:网络
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 开发者_如何学Go

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

精彩评论

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