开发者

Set Controls with arbitrary positions on CTabItem

I am new to SWT, and I need to set the controls positions arbitrary on CTabItem.

I've used the following code, but it seems that it had no positioning effect, it just add the component to (0, 0)

Label userName = new Label(folder, SW开发者_如何转开发T.NONE);
userName.setText("username");
userName.setBounds(10, 200, 200, 50);
item.setControl(userName);


You will need to set a LayoutManager to folder, e.g.:

folder.setLayout(new GridLayout());

If you wish to give the control a certain dimensions, consider giving it LayoutData, e.g.:

GridData gd = new GridData();
gd.height = 50;
userName.setLayoutData(gd);

I'm not sure what item is in your example, but it doesn't seem to be necessary.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜