In my program i have a JTree
which is being populated by a number of folders and files. When you select a file in the JTree
I want that file to display in the JTextArea
.
I no you can use getLastSelectedPathComponent()
to get the last selected item from the JTree
which can be used to get the chosen file from the tree but this is then a node of the tree... is there a way to get the text from this node like using a FileReader
and a BufferReader
?
Not directly. What you will need to do:
DefaultMutableTreeNode
for this.