change all the label icon in a panel
Posted
by Josh
on Stack Overflow
See other posts from Stack Overflow
or by Josh
Published on 2010-05-29T10:04:53Z
Indexed on
2010/05/29
10:12 UTC
Read the original article
Hit count: 128
I have a panel with several JLabel, I would like to change all their Icon,
String path = System.getProperty("user.dir");
for (int x=0;x< 21;x++) {
javax.swing.JLabel lab = boardPanel.getComponent(x).;
lab.setIcon(new ImageIcon(path + "\\image\\blank.jpg"));
}
it gives me an error of incompatible type, all inside the boardPanel are JLabel, im using netbeans 6.8.
© Stack Overflow or respective owner