I have an array of 64 JButtons and want to give them all hidden values of co-ordiantes which must stay the same. The text on the JButton will change according to what co-ordinate is chosen.
Is there a way to do this?
This is my code for putting text onto the buttons:
for (int j = 0; j < pieces.length; j++){
for (int i = 0; i < pieces[j].length; i++){
if (pieces[i][j] == null)
contentPane.add(new JButton(" "));
else {
p = pieces[i][j].getChar();
System.out.println(i + ","+j+","+p);
contentPane.add(new JButton (Character.toString(p)));
}
}
}