When I try to display ImageIcon in JTable only description is rendered.The code is:
private void createTable() {
dataModel = new AbstractTableModel() {
@Override
public int getColumnCount() { return 10; }
@Override
public int getRowCount() { return 10;}
@Override
public ImageIcon getValueAt(int row, int col) {
icon=new ImageIcon();
icon=createImageIcon("..\\studentimages\\img0.png","angry"); //method to render url of image
// STUDENT_IMG_LBL=new JLabel(icon);
return icon ;
}
};
}
You can try to return the ImageIcon as column class. If it doesn’t help define your own Renderer extending DefaultTableCellRenderer and set the icon to the renderer.