文件名称:JTree响应选中节点Demo.rar
文件大小:40KB
文件格式:RAR
更新时间:2023-05-03 08:55:41
java
tree.addTreeSelectionListener(new TreeSelectionListener()
{
@Override
public void valueChanged(TreeSelectionEvent e)
{
if(!tree.isSelectionEmpty())
{
//判断节点是否被选中,被选中为0,没被选中为1
TreePath[] selectionPath = tree.getSelectionPaths();//获取所有被选中节点的路径
StringBuilder sb = new StringBuilder();
sb.append("<html><body>");
for(int i = 0; i < selectionPath xss=removed xss=removed xss=removed xss=removed>");
}
sb.append("
");
}
sb.append("</body></html>");
label.setText(sb.toString());
}
}
});
【文件预览】:
Demo_App
----.project(384B)
----bin()
--------CheckBoxEx$1.class(2KB)
--------TextFieldEx$1.class(1KB)
--------BtnEx$3.class(2KB)
--------Btn2dEx$3.class(3KB)
--------BtnEx.class(2KB)
--------JTreeSelect.class(2KB)
--------MyButtonEditor$1.class(664B)
--------BtnEx$5.class(715B)
--------Btn2dEx$4.class(1KB)
--------Btn2dEx$1.class(3KB)
--------BtnEx$4.class(1KB)
--------JTreeDemo.class(2KB)
--------TextFieldEx.class(1KB)
--------Btn2dEx$2.class(3KB)
--------BtnEx$2.class(2KB)
--------BtnUi.class(2KB)
--------TableBtn$1.class(2KB)
--------JTreeSelect$1.class(2KB)
--------MyButtonEditor.class(2KB)
--------BtnEx$1.class(2KB)
--------TableBtn.class(2KB)
--------Btn2dEx.class(3KB)
--------MyButtonRender.class(1KB)
--------Btn2dEx$5.class(727B)
--------TextFieldBorder.class(2KB)
--------CheckBoxEx.class(2KB)
--------MainClass.class(402B)
--------Btn2D.class(1023B)
----.settings()
--------org.eclipse.jdt.core.prefs(598B)
----src()
--------TableBtn.java(3KB)
--------MainClass.java(423B)
--------BtnUi.java(1KB)
--------TextFieldBorder.java(1KB)
--------MyButtonEditor.java(3KB)
--------BtnEx.java(4KB)
--------MyButtonRender.java(1KB)
--------Btn2dEx.java(7KB)
--------JTreeSelect.java(2KB)
--------CheckBoxEx.java(2KB)
--------TextFieldEx.java(2KB)
--------JTreeDemo.java(2KB)
--------Btn2D.java(593B)
----.classpath(301B)