Pardon my lack of knowledge and maybe improper terminology, as I'm new to Java. Here is a simplified version of my code so far:
import javax.swing.ImageIcon;
public class Cards {
static ImageIcon CA = new ImageIcon("classic-cards/1.png");
}
Also in another class where playerCard[] is an array of JLabels:
String suit = "C";
String rank = "A";
playerCard[playerTurn].setIcon("Cards." + suit + rank);
Obviously setIcon does not use the String as an argument and therefore this will not work. How can I get this to work? Since this is a deck of cards suit and rank will not always be "C" and "A" but I did this for simplification.