1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
Tree tree = new Tree(shell,SWT.FULL_SELECTION);
TreeColumn col1 = new TreeColumn(tree,SWT.LEFT);
col1.setWidth(150);
TreeColumn col2 = new TreeColumn(tree,SWT.LEFT);
col2.setWidth(150);
TreeItem item = new TreeItem(tree, SWT.NONE);
item.setText("father");
TreeItem item2 = new TreeItem(item, SWT.NONE);
item2.setText("child1");
TreeEditor editor = new TreeEditor(tree);
editor.grabHorizontal = true;
editor.grabVertical = true;
ProgressBar pb = new ProgressBar(tree, SWT.INDETERMINATE);
editor.setEditor(pb, item, 1);
pb.setVisible(false);
shell.setSize(400,400);
shell.open();
while(!shell.isDisposed()){
if (!display.readAndDispatch())display.sleep();
}
display.dispose(); |