Eclipse插件(RCP)将 Label 和 Text 组件放在一行显示
作者:互联网
效果
重要代码
// 外层容器
Composite container = new Composite(parent, SWT.NULL);
container.setLayout(new FillLayout());
Composite tmpComp = new Composite(container, SWT.NULL);
tmpComp.setLayout(new GridLayout(2,false));
// 创建“平台名称”文本框
new Label(tmpComp,SWT.NONE).setText("平台名称:");
new Text(tmpComp, SWT.BORDER).setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
总结
- 容器层一般使用
FillLayout
,可以是内容填充整个视图。 - 类似于Label和输入框在同一行的布局使用到
GridLayout
和 其参数GridData
。
标签:GridData,插件,Composite,Eclipse,RCP,tmpComp,Label,new,SWT 来源: https://blog.csdn.net/m0_47406832/article/details/120826237