import java.awt.Component;
import com.sun.java.swing.JLabel;
import com.sun.java.swing.ImageIcon;

class DirElement
{
    // supported exts are: public static final String[] names= {"Nom","Type"}; => please put this array in the last subclass of DirElement; see getValueAt
    Component[] components; // Nom/Type
    String name;
    public Object relatedObject;

    DirElement(String name, Object relatedObject, Component[] components)
    {
	this.components= components;
	this.name= name;
	this.relatedObject= relatedObject;
	components[0]= new JLabel(name);
	components[1]= new JLabel((new com.sun.java.swing.plaf.basic.BasicTreeCellRenderer()).getClosedIcon()); // JLabel(new ImageIcon("garfield_moon.gif"));
    }

    public DirElement(String name, Object relatedObject)
    {
	this(name,relatedObject,new Component[2]);
    }

    public Object getValueAt(int i)
    {
	return (i<components.length)?components[i]:null;
    }

    public String toString()
    {
	return name;
    }
}
