Customize Cell Renderer based on the row rather than the column
Opened this issue · 1 comments
Can you customize cell render based on the row ?
For example consider the column number 2, i need some rows having a JComboBox as cell renderer and some others having a JLabel
Hi - you can, but this is a function of a JTable, not the TreeTable model. The TreeTable is only concerned with the tree aspects of the tree table. One of the big advantages of this code is that you are basically working with a standard JTable.
JTable has a method you can override to customise which TableCellRenderer is used for rows or columns:
https://docs.oracle.com/javase/8/docs/api/javax/swing/JTable.html#getCellRenderer-int-int-
Also see this stack overflow article:
https://stackoverflow.com/questions/16407086/apply-a-tablecellrenderer-on-a-single-cell
Hope that helps!