您可以使用 定义 a 的跳位Composite
顺序Composite#setTabList(Control[])
。
这是一个小例子,它将在Button
s之间制表符one
并three
忽略Button
stwo
和four
:
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new GridLayout(1, false));
Composite content = new Composite(shell, SWT.NONE);
content.setLayout(new GridLayout(2, true));
content.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
final Button one = new Button(content, SWT.PUSH);
one.setText("One");
final Button two = new Button(content, SWT.PUSH);
two.setText("Two");
final Button three = new Button(content, SWT.PUSH);
three.setText("Three");
final Button four = new Button(content, SWT.PUSH);
four.setText("Four");
Control[] controls = new Control[] {one, three};
content.setTabList(controls);
shell.pack();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
编辑:上面的代码可以很容易地转换为适合您的要求。我自己无法测试它,因为Composite
s 不能聚焦,但你应该明白:
mainPane.setTabList(new Control[] {customPanel1, customPanel2, customPanel3 });
customPanel1.setTabList(new Control[] {});
customPanel2.setTabList(new Control[] {});
customPanel3.setTabList(new Control[] {});