• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JTree CellEditor with Combobox and Textfield

 
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Put the moon back where you found it! We need it for tides and poetry and stuff. Like this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic