Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] strange things about TreeEditor !

hello all,
this is my code snippet;
import org.eclipse.swt.*;
import org.eclipse.swt.custom.TreeEditor;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.*;
public class Snippet {

static Display display = Display.getDefault();
final static Shell shell = new Shell(display);
final static Tree tree = new Tree(shell, SWT.BORDER |SWT.MULTI);
public static void main (String [] args) {
shell.setLayout(new FillLayout());
shell.open();

for (int i = 0; i < 3; i++) {
TreeItem item = new TreeItem(tree, SWT.NONE);
ProgressBar pb = new ProgressBar(tree, SWT.SMOOTH);
TreeEditor editor = new TreeEditor(tree);
editor.grabHorizontal = true;
editor.setEditor(pb, item);
item.setText("item " + i);
}
while(!shell.isDisposed())
if(!display.readAndDispatch())
display.sleep();
display.dispose();

}
}
-----------------------
I firstly open the shell , and after that I add three TreeEditors to the tree.but I found only the first TreeEditor with
the progressBar is visible . the other two will be visible until I
resize the shell. I only want to dymanicily add the TreeItem with a TreeEditor and a progressBar after the shell is opened .but i found only one TreeEdior can be seen . I have tried to add shell.redraw() or tree.redraw(),but it didn't work. who can tell me what is the problem ? and how can I achive the goal?
Thanks very much!!




===============================================
快来和我一起享受TOM免费邮箱吧! 看看除了1.5G,还有什么?

共同体验超大容量!超强防御!专业杀毒!专业防垃圾!

明星送祝福(http://sr.tom.com): 周杰伦  蔡依林  王力宏  田震  代您送去生日祝福

万首金曲免费送(http://mm.tom.com/ivr/) : 你到底爱谁   千年之恋  我是真的爱你   一辈子做你的女孩

全部彩铃免费送(http://mm.tom.com/cailing/): 我发财了发财了  你喜欢 我就说嘛  两只蝴蝶   冲动的惩罚
===============================================

Back to the top