• 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

Multi-cell edit of JComboBoxes in JTable

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I'm new to Swing and I wonder if anybody could give me any idea how to go about setting up a JTable which would allow JComboBoxes in multiple cells to be amended at once. Unfortunately I haven't been able to find any examples using Google etc.

Many thanks for any ideas,

Joseph
 
Author
Posts: 986
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Joseph Sheridan:
how to go about setting up a JTable which would allow JComboBoxes in multiple cells to be amended at once.



I'm not sure what exactly you mean by amended here.

The way a JTable's cell editor works is that only one cell can be edited at a time. If you want, you can use a JComboBox in an editor and repopulate it every time the user starts editing a cell.
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
not tried it with comboboxes in a JTable, but normally you would just set their models the same

 
Joseph Sheridan
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

many thanks Brian and Michael for your comments / example. Sorry I haven't been clear about what I'm trying to achieve. I want to have a column in a JTable with a JComboBox with values. I would like to be able to select a number of cells in this column and then use the JComboBox in one of these cells to select a value which would then be applied to all the selected cells.

Thanks again for your help,

Joseph
reply
    Bookmark Topic Watch Topic
  • New Topic