如何动态地在JTable中添加图像

时间:2012-04-27 07:04:08

标签: java image swing jtable

BufferedImage img = null;
        ImageIcon icon = null;
        try {
            img = ImageIO.read(new File("resources/" + imageString));           
        } catch (IOException e) {           
            e.printStackTrace();
        }
        img = ImageScaler.getScaledImage(img, 35, 35);
        icon = new ImageIcon(img);
table.setValueAt(icon, 1, 0);

这是我的代码。但是不显示图像。我需要一些帮助来找出我出错的地方。

3 个答案:

答案 0 :(得分:4)

答案 1 :(得分:3)

以下链接可帮助您将图像添加到jtable。

答案 2 :(得分:2)

相关问题