• Post Reply Bookmark Topic Watch Topic
  • New Topic

JTree CellEditor with Combobox and Textfield

 
Sri Rangan
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to create a TreeCellEditor with more than one component ( Jcombobox and JTextfield).
I need to create a TreeNode with JCombobox and JTextfield.
Thanks for your help.
 
Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
use an editable JComboBox. You will most probably have to write your own ComboBoxModel to handle the data the best way. See the sun tutorial on combo boxes, and the API doc of JComboBox.
chantal
 
Sri Rangan
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply.
On a TreeNode, I need to create one JCombobox and 2 JTextFields.
I created my own TreeCellRenderer and added a JPanel which has these three compoenents.
Though I am able to paint the components, the components are not editable.
I am wondering how to implement a TreeCellEditor to accomodate these three components.
Sri
 
Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I have implemented a JPanel as TableCellRenderer not as TreeCellRenderer, but I think it works similar (it should, anyway). I got the code from this site:
http://www.codeguru.com/java/articles/162.shtml
the trick is to delegate the mouse events through to the JPanel.
regards
Chantal
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!