Using edwards revised code, i now have this:
int k, l, tempA, tempB;
for (k = 0; k < 13; k++) {
for (l = 0; l < 4; l++) {
tempA = rndm.get(k);
tempB = suit.get(l);
// increment # and convert into string
buttonNumber++;
buttonName = Integer.toString(buttonNumber);
// assign new button to the array
cardButton[k * 4 + l] = new JButton(buttonName);
// assign button image icon
cardButton[k * 4 + l].setIcon(cardImage[tempA][tempB]);
// assign value to the check variable
check[k * 4 + l] = Integer.toString(tempA+1);
// make button invisible for now
cardButton[k * 4 + l].setVisible(false);
// add the button to the board
board.add(cardButton[k * 4 + l]);
}
}
but my problem with this is that I need a replacement for the nested loop because the way it is set up now, it displays x value in 4 different suits before displaying the next value, when what i need is for it to display x value and x suit without repeating a value once, unless done randomly. The reason this is happening is because of the nested loop which iterates through k once, and then through l four times.