我有一个对象的数组列表,其中包含属性标题、导演、评级和图像的路径名。我想要在 for 循环中用这些数据动态填充 JTable,如以下伪代码所示:
for(int i = 0; i < movieCatalog.size(); i++)
{
imageCell = movieCatalog.get(i).getImagePath();
titleCell = movieCatalog.get(i).getTitle();
directorCell = movieCatalog.get(i).getDirector();
ratingCell = movieCatalog.get(i).getRating();
}
因此,对于数组列表中的每个槽,我想将数据放入每行各自的单元格中。
如何将图像放入每个单元格中?我知道我需要设置图像渲染,但我不知道该怎么做。将数据添加到表中的代码以及图像渲染器将不胜感激。
最佳答案
How do I put the image into each cell?. I understand that I need to set up an image render but I don't know how to do this.
关于java - 将图像添加到每个 JTable 单元格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16857302/