I think I got the imageIcon to show up differently in each cell but for some reason when I compile it, the images don\'t show up. It displays the name of the image but the image
You can pass in the name of the image when you call the new ImageRenderer
constructor (read this).
public class Movies extends javax.swing.JFrame {
public Movies() {
initComponents();
table.getColumnModel().getColumn(1).setCellRenderer(new ImageRenderer("1.jpg"));
table.getColumnModel().getColumn(0).setCellRenderer(new ImageRenderer("2.jpg"));
}
}
class ImageRenderer extends DefaultTableCellRenderer {
ImageIcon icon = null;
ImageRenderer(String iconName) {
icon = new ImageIcon(getClass().getResource(iconName));
}
}