Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JTree Renderer - Editable issue  RSS feed

 
Sainath Veepuri
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I have created a custom tree cell renderer class which extends DefaultTreeCellRenderer. Basically I made getTreeCellRendererComponent method return a JLabel on which there are two JLabels and two JTextFields.

Now my issue is that I'am unable to edit the JTextField added on the renderer.

How do I go about it.

Thank you,
Sai.
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try making yourself a class that implements TreeCellEditor and uses the same kind of Component, ie JLabel with labels and JTextFields on it, as your cell renderer. The idea is that when you select a node for editing the editor will appear and look just the same as the rendered node.
 
Sainath Veepuri
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Craig,
Thank you for your response.
Ya, I will try that and see.

Thank you again,
Sai.
 
Sainath Veepuri
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Craig.. It worked.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!