Jtree von Path erstellen

Hi,

kennt jemand eine Library/Codestueck oder was auch immer, was automatisch aus einerm java.io.Path einen JTree erstellt?

Man kann es auch selbst machen, ja, aber wenn jemand eine gute Loesung weiss, wuerde ich die gern nehmen.

Also kennt jemand da was ?

Thx

Hab ich gerade auf Streams umgeschrieben, könnte man vielleicht auch noch lazy machen usw. usf.

class FileNode implements TreeNode {

	private final Path path;

	private final List<FileNode> children;

	private final FileNode parent;

	public FileNode(Path a_path, FileNode a_parent) {
		this.parent = a_parent;
		this.path = a_path;
		this.children = new ArrayList<>();
		if (Files.isDirectory(path)) {
			try {
				Files.list(path).forEach(p -> {
					children.add(new FileNode(p, this));
				});
			} catch (IOException e) {
				// von mir aus einen Fehlerknoten Einhängen oder sonst was...
			}
		}
	}

	public TreeNode getChildAt(int childIndex) {
		return children.get(childIndex);
	}

	//nein   @Override  ich will dich nicht erwähnen
	public int getChildCount() {
		return children.size();
	}

	public TreeNode getParent() {
		return parent;
	}

	public int getIndex(TreeNode node) {
		return children.indexOf(node);
	}

	public boolean getAllowsChildren() {
		return 0 < children.size();
	}

	public boolean isLeaf() {
		return 0 == children.size();
	}

	public Enumeration children() {
		return this.children();
	}

	public String toString() {
		return path.toString();
	}
}