List of usage examples for javax.swing.tree DefaultMutableTreeNode isNodeDescendant
public boolean isNodeDescendant(DefaultMutableTreeNode anotherNode)
anotherNode
is a descendant of this node -- if it is this node, one of this node's children, or a descendant of one of this node's children. From source file:streamme.visuals.Main.java
public void addToPlaylist(DefaultMutableTreeNode node, int listIdx, boolean recursive) { DefaultMutableTreeNode leaf = node.getFirstLeaf(); while (node.isNodeDescendant(leaf)) { DataNode dn = (DataNode) leaf.getUserObject(); javax.swing.tree.TreeNode[] tree = leaf.getPath(); String path = StreamMe.OPTIONS.getOutputPath(); for (int i = 1; i < tree.length; i++) { path += "\\" + ((DataNode) ((DefaultMutableTreeNode) tree[i]).getUserObject()).getName(); }//from w w w . j av a2 s.co m PlaylistManager.get().addToPlaylist(listIdx, dn.toFileLink(path)); leaf = leaf.getNextLeaf(); } }