你的代码只改变了树,没见操作Jlist啊
解决方案 »
- javax.naming.ServiceUnavailableException
- java.speech 这个jar那里有下
- 这是什么错误啊!刚学不知道!是不是少了哪些包?
- 本人刚学完java基础知识,想看看完整的源代码----------》关于窗体的有吗? 我还有一帖,给源代码就结帖!
- 请给我一段,从键盘读取字符,并原样输出的代码,另请加以语法注明,谢谢!
- 高分相赠!!!如何捕捉throws的异常????
- java读取oracle的blob字段空指针错误!!!太奇怪了
- 为什么我的Applet在浏览器后退再前进到这个页面时还是会调用init函数?
- 异常。
- 请大家推荐一些学习Java好的站点。谢了。
- Error: Class jni could not be found.原因是什么?谢谢!
- 我靠,JBuilder 9怎么就那么那么那么那么那么那么那么那么慢啊???
DefaultTreeModel model = (DefaultTreeModel) m_treeFile.getModel();
//explore tree's first layer
if (!filenode.isExplored()) {
File[] filelist = filenode.getFile().listFiles(filter);
for (int i = 0; i < filelist.length; i++) {
if (filelist[i].isDirectory()) {
Filenode node = new Filenode(filelist[i]);
model.insertNodeInto(node, filenode, filenode.getChildCount());
m_treeFile.scrollPathToVisible(new TreePath(node.getPath()));
}
} filenode.setExplored(true);
}
else
{
m_treeFile.expandPath(m_treeFile.getSelectionPath());
} //explore tree's second layer
Enumeration enum = filenode.children();
if(enum==null)
{
m_treeFile.setSelectionPath(new TreePath(filenode.getPath()));
return;
}
Filenode childnode = null;
do {
childnode = (Filenode) enum.nextElement();
}
while (childnode.getFile().getName().compareTo(name) != 0);
if (childnode.isExplored()) {
m_treeFile.setSelectionPath(new TreePath(childnode.getPath()));
return;
} if (childnode == null) {
m_treeFile.setSelectionPath(new TreePath(filenode.getPath()));
return;
}
File[] childfilelist = childnode.getFile().listFiles(filter);
if(childfilelist==null)
{
m_treeFile.setSelectionPath(new TreePath(childnode.getPath()));
return;
}
for (int j = 0; j < childfilelist.length; j++) {
if (childfilelist[j].isDirectory()) {
Filenode node = new Filenode(childfilelist[j]);
model.insertNodeInto(node, childnode, childnode.getChildCount());
m_treeFile.scrollPathToVisible(new TreePath(node.getPath()));
}
}
childnode.setExplored(true);
m_treeFile.setSelectionPath(new TreePath(childnode.getPath())); }
}