| |
17. 64. 2. 横向或纵向工具栏 |
|
ToolBar toolBar = new ToolBar(shell, SWT.HORIZONTAL);
ToolBar toolBar = new ToolBar(shell, SWT.VERTICAL);
|
|
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
public class ToolBarVertical {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
ToolBar bar = new ToolBar(shell, SWT.BORDER|SWT.VERTICAL);
for (int i = 0; i < 4; i++) {
ToolItem item = new ToolItem(bar, 0);
item.setText("Item " + i);
}
bar.pack();
shell.pack();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}
|
|
|