我正在尝试为 Eclipse 编辑器设计一个表单并遇到一些问题。
这个想法是有一个包含 2 个部分的页面 - 左侧部分包含一个表格和两个按钮。该表应与该部分的顶部对齐并向右扩展至底部。我希望按钮位于该部分中表格的右侧,每个按钮在另一个下方,并与表格顶部对齐。
有谁知道我需要为 GridLayouts 设置哪些设置才能完成这项工作?我已经尝试了所有我能想到的组合,但没有运气。
我能得到的最接近的结果是页面底部的第二个按钮。
到目前为止,这是我的代码的摘录:-
Section section = toolkit.createSection(sashForm, ExpandableComposite.TITLE_BAR | ExpandableComposite.EXPANDED | ExpandableComposite.NO_TITLE_FOCUS_BOX);
section.setText("All Items");
Composite client = toolkit.createComposite(section);
section.setClient(client);
client.setLayout(new GridLayout(2, false));
Table table = toolkit.createTable(client, SWT.NULL);
table.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING));
TableViewer viewer = new TableViewer(table);
Button addButton = toolkit.createButton(client, "Add", SWT.PUSH);
addButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING));
Button removeButton = toolkit.createButton(client, "Remove", SWT.PUSH);
removeButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING));