我写好了一个TreeView,当我选中一个节点怎么在一个Label中动态显示我所选的节点啊。谢谢帮忙了。
解决方案 »
- 2012辽宁赛区电子设计竞赛 资源求助
- new求解答!
- 【求助】使用Myeclipse把程序打成jar包运行和在Myeclipse里面执行有什么区别
- ”声明为static的方法不能访问非static类成员“这句话到底怎么理解?
- 如何对jar进行堪错啊?
- ●●<Java编程思想第二版>比第一版有很大不同吗?我持有第一版,有否必要买第二版?●●
- 初学JAVA遇到的问题,help!
- 征求意见:Tomcat适合做大网站否?
- 请问如何用java写一个日志文件
- 有谁知道Hastable和Vector的区别?举个列子多谢!!!
- 谁能帮忙解释下面的代码(运行异常)
- 学习JAVA半年的一些心德与大家探讨,让我不再彼视大学生
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;/**
* @author Steven Holzner
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/public class SWTTrees { public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setText("Trees"); final Tree tree = new Tree(shell, SWT.BORDER);
tree.setSize(290, 290);
shell.setSize(300, 300); for (int loopIndex1 = 0; loopIndex1 < 5; loopIndex1++) {
TreeItem item0 = new TreeItem(tree, 0);
item0.setText("Level 0 Item " + loopIndex1);
for (int loopIndex2 = 0; loopIndex2 < 5; loopIndex2++) {
TreeItem item1 = new TreeItem(item0, 0);
item1.setText("Level 1 Item " + loopIndex2);
for (int loopIndex3 = 0; loopIndex3 < 5; loopIndex3++) {
TreeItem item2 = new TreeItem(item1, 0);
item2.setText("Level 2 Item " + loopIndex3);
}
}
} shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}
博客网版权所有