Hello,
I am planning to program an Xml displayer that will show an Xml file
in a tree view. This will involve the development of a tailored tree
model which will use DOM nodes instead of the DefaultMutableTreeNode.
To get an idea of how a tree model can be generated, I have downloaded
an example from the sun homepage in which file objects are used as
TreeNodes. This program resembles mine in that the tree will be
constructed from objects which are differnt from the standard TreeNode
object. HOwever, I think that I have not yet got a very basic conecept
of Java, because I do not know what e.g. the following lines mean
<Snip>
public boolean isLeaf(Object node) { return ((File)node).isFile();
}
public int getChildCount(Object parent) {
String[] children = ((File)parent).list();
if (children == null) return 0;
return children.length;
}
</Snip>
particular the notation "((File)node)".
The isLeaf function receives an "Object" as argument which probably
does not have an "isFile" method. So does the expression ((File)node)
gives some of the methods for "File" objects to the general "Object"
object? How is this language feature called, because I have frequently
seen lines like this and I would like to understand that topic.
Thanks in advance
Peter