Reputation: 2757
I have a JTable
which has 5 rows and 8 columns. I want to add checkboxes only in the last row. So i tried an example from How to add checkboxes to JTABLE swingh. In that example I am seeing checkbox adding for column only...But how to add checkboxes in the last row of all cells?
Upvotes: 2
Views: 2631
Reputation: 3750
JTable has two methods of interest: getCellRenderer(int, int)
and getCellEditor(int, int)
. By overriding both you can provide specific renderer/editor components based on the row and column that is being rendered/edited. You might need a creative TableModel though - the swing JTable wasn't intended to handle different types of items depending on row.
Upvotes: 2
Reputation: 109815
JTable (and similair GUI, MsExcell, Databases) is based on Column direction
in mentioned example is strictly defined ColumnClass for XxxTableModel, remove these code line
is possible to create and defined ColumnClass
for concrete cell (every cells in the last row), but required proper definitions in XxxTableModel
maybe easiest of ways is to use Render,
your question isn't specific for detailed answer, sure maybe there are another options
Upvotes: 2