作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有 4 列的 GridLayout,但无法获取最后一列(带有路径 Text
小部件的列)来获取多余的水平空间。
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
((GridLayout)composite.getLayout()).numColumns = 2;
Label label = null;
GridData data = null;
Composite compo = null;
Composite compo2 = null;
GridLayout layout = null;
// accounts label
label = new Label(composite, SWT.LEFT);
label.setText("Accounts");
data = new GridData();
data.horizontalSpan = 2;
label.setLayoutData(data);
//accounts combo
ComboViewer accountsCombo = new ComboViewer(composite);
accountsCombo.getCombo().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
//accounts add button
Button btnAddAccount = new Button(composite, SWT.PUSH);
btnAddAccount.setText(BUTTON_ADD_ACC_LABEL);
btnAddAccount.setLayoutData(new GridData());
// repo-package composite
compo = new Composite(composite, SWT.NONE);
data = new GridData(SWT.FILL, SWT.FILL, true, false);
data.horizontalSpan = 2;
compo.setLayoutData(data);
layout = new GridLayout();
layout.marginWidth = 0;
layout.numColumns = 2;
compo.setLayout(layout);
//repo composite
compo2 = new Composite(compo, SWT.NONE);
data = new GridData(SWT.FILL, SWT.FILL, true, false);
compo2.setLayoutData(data);
layout = new GridLayout();
layout.marginWidth = 0;
compo2.setLayout(layout);
//repo label
Label repoLabel = new Label(compo2, SWT.LEFT);
repoLabel.setText("Repository");
//repo combo
ComboViewer repoCombo = new ComboViewer(compo2);
repoCombo.getCombo().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
//package composite
compo2 = new Composite(compo, SWT.NONE);
compo2.setLayoutData(data);
layout = new GridLayout();
layout.marginWidth = 0;
compo2.setLayout(layout);
//package label
label = new Label(compo2, SWT.LEFT);
label.setText("Package");
//package combo
ComboViewer packageCombo = new ComboViewer(compo2);
packageCombo.getCombo().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
// version group
Group versionGroup = new Group(composite, SWT.NONE);
versionGroup.setText("Version");
data = new GridData(SWT.FILL, SWT.FILL, true, false);
data.horizontalSpan = 2;
versionGroup.setLayoutData(data);
layout = new GridLayout();
versionGroup.setLayout(layout);
// replace radio
Button radioReplaceVersion = new Button(versionGroup, SWT.RADIO);
radioReplaceVersion.setText("replace");
radioReplaceVersion.setSelection(true);
// replace composite
compo = new Composite(versionGroup, SWT.NONE);
data = new GridData(SWT.FILL, SWT.FILL, true, false);
layout = new GridLayout();
layout.numColumns = 4;
compo.setLayoutData(data);
compo.setLayout(layout);
// name label
label = new Label(compo, SWT.LEFT);
label.setText("name:");
data = new GridData(SWT.LEFT, SWT.CENTER, false, false);
label.setLayoutData(data);
// name text widget
Text nameText = new Text(compo, SWT.SINGLE | SWT.BORDER);
data = new GridData(SWT.FILL, SWT.FILL, false, false);
data.widthHint = 150;
nameText.setLayoutData(data);
// path label
label = new Label(compo, SWT.LEFT);
label.setText("path:");
data = new GridData(SWT.LEFT, SWT.CENTER, false, false);
label.setLayoutData(data);
// path text widget
Text pathText = new Text(compo, SWT.SINGLE | SWT.BORDER);
data = new GridData(SWT.FILL, SWT.FILL, true, false);
pathText.setData(data);
/*
for (Control cnt : compo.getChildren()) {
cnt.setEnabled(false);
}
*/
// new radio
Button radioNewVersion = new Button(versionGroup, SWT.RADIO);
radioNewVersion.setText("new");
//resource label
label = new Label(composite, SWT.LEFT);
label.setText("Resources");
data = new GridData();
data.horizontalSpan = 2;
label.setLayoutData(data);
// resource composite
compo = new Composite(composite, SWT.NONE);
compo.setLayout(new GridLayout());
data = new GridData(SWT.FILL, SWT.FILL, true, true);
data.horizontalSpan = 2;
compo.setLayoutData(data);
// resource widget
createResourcesGroup(compo);
return parent;
}
最佳答案
行:
pathText.setData(data);
应该是:
pathText.setLayoutData(data);
setLayoutData
不是 setData
。
关于java - SWT - 最后一列不会占用多余的水平空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31896173/
我的服务层有如下方法 public ModuleResponse GetModules(ModuleRequest request) { var response = new ModuleRe
我构建的工具栏与大多数工具栏一样,minHeight 设置为 actionBarSize: 但是,如果我删除这个属性,就完全没有区别了。工具栏保持其 actionBarSize,即使我删除菜单并将
我已经为 SVG 和剪辑路径苦苦挣扎了一段时间。 我正在尝试创建一个三 Angular 形剪辑路径,它将覆盖照片以给顶部一个“三 Angular 形”边缘。 我试图实现与照片完全相同的效果,但三 An
我有一个带有 2 个索引的 PostgreSQL 表。其中一个索引涵盖了 website_id 和 tweet_id 列,是一个唯一的 B 树索引。第二个索引只覆盖 website_id 列,是一个非
我是一名优秀的程序员,十分优秀!