我试图在节标题栏的末尾放置一个组合框,以便我使用 SWT 的 setTextClient(Control) 方法。 我可以在部分标题栏中看到该组件,但那是在最末端,但我不希望部分标题和标题栏之间有太多空间。
用户界面-
从上图中可以清楚地看到 AND 和 OR 单选按钮出现在最后,并且 Filter Title 和 Title Bar 之间有一个空格。
以下是我用来实现相同目的的代码片段-
Composite toolbar = toolkit.createComposite(section, SWT.WRAP);
RowLayout rlayout = new RowLayout(SWT.HORIZONTAL);
toolbar.setCursor(Display.getDefault().getSystemCursor(SWT.CURSOR_HAND));
rlayout.marginLeft = 0;
rlayout.marginRight = 0;
rlayout.spacing = 0;
rlayout.marginTop = 0;
rlayout.marginBottom = 0;
toolbar.setLayout(rlayout);
Button A = new Button(toolbar, SWT.RADIO);
A.setText("AND");
Button r = new Button(toolbar, SWT.RADIO);
r.setText("OR");
section.setTextClient(toolbar);
section.setText(type.name());
section.setClient(client);
section.setExpanded(true);
最佳答案
找到了解决方案, 它实际上是与部分声明一起的。
Section section = toolkit.createSection(compositeRightDownContent,
Section.LEFT_TEXT_CLIENT_ALIGNMENT | Section.COMPACT);
成功了
关于eclipse - SWT 部分 setTextClient 将组合放在标题栏的末尾,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12157712/