/** Construct a FileTree */
public FileTree(File dir) {
setLayout(new BorderLayout());
applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
setBorder(null);
// Make a tree list with all the nodes, and make it a JTree
JTree tree = new JTree(addNodes(null, dir));
tree.applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
// Add a listener
tree.addTreeSelectionListener(new TreeSelectionListener() {
public void valueChanged(TreeSelectionEvent e) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode) e
.getPath().getLastPathComponent();
}
});
add(BorderLayout.CENTER, tree);
JScrollPane scrollBarExplorer = new JScrollPane();
scrollBarExplorer.getViewport().add(tree);
scrollBarExplorer.setBorder(null);
add(scrollBarExplorer, BorderLayout.CENTER);
}
FileTree.java 文件源码
java
阅读 31
收藏 0
点赞 0
评论 0
项目:Mujeed-Arabic-Prolog
作者:
评论列表
文章目录