I want to create a JTree, and each node of the JTree has a name, and when you click on the node, a textarea will be expanded, I did some research online but didn't find anything useful. Could anyone tell me if this possible to achieve? if y开发者_JAVA技巧es, could you please post a simple code sample?
You dont need JTextAreas, JTree has the ability built-in to make Nodes editable. Take a look at this example:
http://www.roseindia.net/java/example/java/swing/JTreeEditable.shtml
I just tried it out to make sure it works. Compile & Run. Click on one of the Nodes then press F2 to edit it. Please comment if you have questions or if this is not what you are looking for.
精彩评论