• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

JComboBoxes dependency in JTable

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, my question is if it's possible to make "interactive" JComboBox in JTable, this interactiveness should depends on selection item in one box and then the items of second box should change depending on the choice in the first box. I have write some code allready but it doesn't work as it should be, every advices are welcome.
 
Rancher
Posts: 3324
32
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Override the getCellEditor(...) method of JTable to determine which combo box to use.

Here is an example that changes the combo box based on the selected row. In your case you would choose which combo box to used based on the value of the related column.

 
Radek Gajdos
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Rob for your suggestion, i have overrided the getCellEditor(...) method of JTable and it works perfectly. Below fully runable code. Thank you one more time.
 
The overall mission is to change the world. When you've done that, then you can read this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic