我创建了 9 个 JLables 并设置了默认图像。
现在我需要更改数组中的特定 JLable 图像。我怎样才能做到这一点?
谢谢!
for (int i = 0; i < imgBoxArray.length; i++)
{
imgBoxArray[i] = new JLabel(new ImageIcon("/Users/cameronmurray/Dropbox/JAVA 2/SmartHome/src/smarthome/clock.jpg"));
imgBoxArray[i].setOpaque(true);
imagePanel.add(imgBoxArray[i]);
}
imgBoxArray[i].ImageIcon("/Users/cameronmurray/Dropbox/JAVA 2/SmartHome/src/smarthome/clock.jpg")); //ERROR