Dynamically add images to JTable cells

后端 未结 2 734
灰色年华
灰色年华 2021-01-28 23:49

I am dynamically adding data to a cell with the following code:

for(int i = 0; i < matchedSlots.size(); i++)
{  
  String title = matchedSlots.get(i).getTitle         


        
2条回答
  •  情深已故
    2021-01-29 00:31

    By default JTable can render Images. You just need to override getColumnClass() in the TableModel and return Icon.class for 1st column.

    Look at Renderers and Editors for more details.

提交回复
热议问题