开发者

JTextarea as nodes of JTree

开发者 https://www.devze.com 2023-02-14 18:10 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消