开发者

Set Controls with arbitrary positions on CTabItem

开发者 https://www.devze.com 2023-01-03 06:11 出处:网络
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)

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

精彩评论

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

关注公众号