final Composite topComposite=new Composite(shell, SWT.NONE);
RowLayout topComposite_layout=new RowLayout();
topComposite_layout.type=SWT.VERTICAL;
topComposite.setLayout(topComposite_layout);
Tree tree = new Tree(topComposite, SWT.FULL_SELECTION );
TreeItem root = new TreeItem(tree, SWT.NULL);
root.setText("root");
for (int i = 0; i < 10; i++) {
TreeItem item = new TreeItem(root, SWT.NULL);
item.setText("Item"+i);
Image find_image_xiao=new Image(item.getDisplay(),
"E:\\java\\myeclipse'workspace\\XXX_SW\\" +
"image\\test_image\\frind5hao.png");
item.setImage(find_image_xiao);
}
能成功运行的,但是tree只能看到一个item....自动添加了滚动条了。。root.setSize(...);也没用啊帮帮我啊 谢谢!~~
RowLayout topComposite_layout=new RowLayout();
topComposite_layout.type=SWT.VERTICAL;
topComposite.setLayout(topComposite_layout);
Tree tree = new Tree(topComposite, SWT.FULL_SELECTION );
TreeItem root = new TreeItem(tree, SWT.NULL);
root.setText("root");
for (int i = 0; i < 10; i++) {
TreeItem item = new TreeItem(root, SWT.NULL);
item.setText("Item"+i);
Image find_image_xiao=new Image(item.getDisplay(),
"E:\\java\\myeclipse'workspace\\XXX_SW\\" +
"image\\test_image\\frind5hao.png");
item.setImage(find_image_xiao);
}
能成功运行的,但是tree只能看到一个item....自动添加了滚动条了。。root.setSize(...);也没用啊帮帮我啊 谢谢!~~
// RowLayout topComposite_layout = new RowLayout();
// topComposite_layout.type = SWT.VERTICAL;
// topComposite.setLayout(topComposite_layout);
topComposite.setLayout(new FillLayout()); Tree tree = new Tree(topComposite, SWT.FULL_SELECTION);
TreeItem root = new TreeItem(tree, SWT.NULL);
root.setText("root");
for (int i = 0; i < 10; i++) {
TreeItem item = new TreeItem(root, SWT.NULL);
item.setText("Item" + i);
Image find_image_xiao = new Image(item.getDisplay(),
"E:\\java\\myeclipse'workspace\\XXX_SW\\"
+ "image\\test_image\\frind5hao.png");
item.setImage(find_image_xiao);
}