Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jtable cells

 
ben riches
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,
How can I get every cell within my JTable to have the two combo boxes that are in the code below to display what currently dispaly.
Thanks
Ben
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You would just need to make a TableCellRenderer using the panel holding the two comboboxes ( and a TableCellEditor, too... since you obviously expect users to select values from the comboboxes and change the cell's value). However, why would one cell hold two values? Why not use separate columns to hold each set of data?
 
ben riches
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Nathan Pruett:
You would just need to make a TableCellRenderer using the panel holding the two comboboxes ( and a TableCellEditor, too... since you obviously expect users to select values from the comboboxes and change the cell's value). However, why would one cell hold two values? Why not use separate columns to hold each set of data?


I have the TableCellRenderer class but how would I do the suggested above.
Also I do want to coulmns the first column would get the Table names from the DataBase the second column gets the colum names from that table the user selected in the column.
Coould you helo me construct my code for the table cell renderer?
what I have at the moment
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic