• Post Reply Bookmark Topic Watch Topic
  • New Topic

Multi-cell edit of JComboBoxes in JTable  RSS feed

 
Joseph Sheridan
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • 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
 
Brian Cole
Author
Ranch Hand
Posts: 932
1
  • Mark post as helpful
  • send pies
  • 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.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!