我需要调用pack()
和/或layout()
在我的小部件的构造函数中吗?
(我按照Wrapping an SWT Widget的说明进行操作)
public class MyWidget extends Composite
{
public MyWidget(Composite parent, int style)
{
super(parent, style);
setLayout(new GridLayout(1, false));
Label lblFoo = new Label(this, SWT.NONE);
lblFoo.setText("Don't panic");
Button btnNewButton = new Button(this, SWT.NONE);
btnNewButton.setText("OK");
pack(); // ?
layout(); // ?
}
}