Let's say I have a List
of Items
(my own class that I created that have 5 fields). I want to somehow inject these items into the JTable
.
And in the JTable
I want to have some kind of method like public String determineColumnText(Object o, int col)
where I can convert the received Object
into Item
and then based on the col
take out a specific value from the Item and return it so that it will be shown.
I have tried searching and saw numerous answers saying create AbstractTableModel
however all the tutorials I looked at do not provide anything that I desired. Closest I saw was public Object getValueAt(int rowIndex, int columnIndex)
however that would mean that I would have to store all the objects I want to display inside the AbstractTableModel
. But what if I want to make it so that the Object
is not stored inside AbstractTableModel
but at the same time can be send into the AbstractTableModel
.
Any suggestion as to how to go about doing this?