import javax.swing.*; import javax.swing.tree.*; import javax.swing.event.*; public class Puu1 extends JPanel implements TreeSelectionListener{ JTree puu; public Puu1(){ // kujundusKatsetus(); looPuu(); add(puu); puu.addTreeSelectionListener(this); } public void valueChanged(TreeSelectionEvent e){ // System.out.println(puu.getLastSelectedPathComponent()); TreePath ahel=puu.getSelectionPath(); System.out.println(ahel); // System.out.println(java.util.Arrays.toString(ahel.getPath())); } void kujundusKatsetus(){ // puu.putClientProperty("JTree.lineStyle", "None"); try{ UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsClassicLookAndFeel"); }catch(Exception e){ e.printStackTrace(); } UIManager.LookAndFeelInfo[] kujundused=UIManager.getInstalledLookAndFeels(); System.out.println(kujundused.length); for(int i=0; i