How to get Icon from JTable

后端 未结 4 2002
既然无缘
既然无缘 2020-11-30 15:38

I have changed the cell render in JTable to show image instead of text using the following code:

base_table.getColumnModel().getColumn(3).setCel         


        
4条回答
  •  南笙
    南笙 (楼主)
    2020-11-30 16:08

    The data stored in a JTable can be found in its TableModel. But since it's your code, normally, that builds this TableModel (from a list or an array, typically), you should be able to get the icon from this list or array. Else, just use table.getModel().getValueAt(row, column), and cast it to an ImageIcon.

提交回复
热议问题