File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes JTree - highlight the text when it is being changed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTree - highlight the text when it is being changed" Watch "JTree - highlight the text when it is being changed" New topic
Author

JTree - highlight the text when it is being changed

Alex Ku
Ranch Hand

Joined: Jan 15, 2002
Posts: 47
Hi,
How do you highlight the text in a tree node when the user clicks the node or press F2 to change its value?
Thanks,
Kawaii
Alex Ku
Ranch Hand

Joined: Jan 15, 2002
Posts: 47
In the file that sets up the JTree, I have

I override the getTreeCellEditorComponent in the DefaultTreeCellEditor class

this only works fine with F2 being pressed, not mouse clicked.
Anyone knows how to highlight the text for mouse clicked?
Thanks
[ January 22, 2002: Message edited by: kawaii desu ]

Nathan Pruett - Edited long CODE line.
[ January 23, 2002: Message edited by: Nathan Pruett ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JTree - highlight the text when it is being changed