ola , eu estou com um problema, nao consigo mostrar as minhas imagens no swing
eu tenho este código:
ImageIcon[] image = {
new ImageIcon("/root/Desktop/as.jpg"),
new ImageIcon("/root/Desktop/as.jpg"),
new ImageIcon("/root/Desktop/as.jpg"),
new ImageIcon("/root/Desktop/as.jpg"),
new ImageIcon("/root/Desktop/as.jpg"),
new ImageIcon("/root/Desktop/as.jpg"),
new ImageIcon("/root/Desktop/as.jpg"),
new ImageIcon("/root/Desktop/as.jpg"),
new ImageIcon("/root/Desktop/as.jpg"),
new ImageIcon("/root/Desktop/as.jpg"),
new ImageIcon("/root/Desktop/as.jpg"),
new ImageIcon("/root/Desktop/as.jpg"),
new ImageIcon("/root/Desktop/as.jpg"),
};
public void setImage(ImageIcon[] image ) {
this.image = image;
}
public ImageIcon[] getImage() {
return image;
}
e noutra classe, a dos construtores
package game;
import javax.swing.ImageIcon;
public class Card {
private final String faceCard;
private final String suit;
private final int number;
public ImageIcon image;
Card(String faceCard, String suit, int number_, ImageIcon image) {
this.faceCard = faceCard;
this.suit = suit;
this.number = number_;
this.image = image;
}
public String toString() {
return faceCard + " of " + suit + "\n" + "Value of card: " + number;
}
public int toInt() {
return number;
}
public ImageIcon ImageIcon() {
return image;
}
}
ImageIcon pic = new ImageIcon(myDeckOfCards.getImage());
panel2.add(lab1);
panel2.add(new JLabel(pic));
panel2.add(card1);
panel2.add(pn1);
panel2.add(btn1);
alguem pode ajudar? thanks