Java tutorial
import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTree; import javax.swing.tree.TreePath; public class Main { public static void main(String[] argv) throws Exception { JTree tree = new JTree(); JFrame f = new JFrame(); f.add(new JScrollPane(tree)); f.setSize(300, 300); f.setVisible(true); // Get paths of all selected nodes TreePath[] paths = tree.getSelectionPaths(); } }