dont know how but this solved my problem
public Component getTreeCellRendererComponent(JTree tree, Object value,
boolean sel, boolean expanded, boolean leaf, int row,
boolean hasFocus)
{
System.out.println("value is :"+value.getClass())
if ((value != null) && (value instanceof DefaultMutableTreeNode)) {
Object userObject = ((DefaultMutableTreeNode) value)
.getUserObject()
System.out.println("node is dmtn")
if(userObject instanceof File)
{
System.out.println("value is file")
File tempfile=(File)userObject
this.setText(tempfile.getName())
this.setIcon(fsv.getSystemIcon(tempfile))
}
}
return this
}