• Post Reply Bookmark Topic Watch Topic
  • New Topic

JComboBOx in a Jtable

 
Jean Richard
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
I have a column in a JTable that needs to display values in a JComboBox. My problem is that the contents of the comboBox are different for each row of the JTable.
Can someone direct me on how to program this ?
Thanks in advance
Jean Richard
 
Thomas Suer
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It would be the same way as filling the table's cells with individual values. In your case I would write a table model that returns for this column a set of the appropriate possible values (e.g. an array of values or a self written data class that encapsulates the values) and a table cell renderer for this column that returns a combobox with the appropriate content.
Tom
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!