getLastPathComponent()方法试试。public Object getLastPathComponent() Returns the last component of this path. For a path returned by DefaultTreeModel this will return an instance of TreeNode.Returns:the Object at the end of the pathSee Also: TreePath(Object[])

解决方案 »

  1.   

    我知道了,这样就行:
    DefaultTreeCellRenderer render = (DefaultTreeCellRenderer)this.getCellRenderer();
           JLabel node1=(JLabel)render.getTreeCellRendererComponent(this,node.toString(),true,true,false,node.getLevel(),false);
           System.out.println(node1.getText());
           System.out.println(node1.getIcon().toString());
           //node1.setText(node.toString());
           //node1.setIcon(open);
           this.repaint();