I am making a board game and cannot move it. The piece will move according to the result of the bone. The following is what I'm trying to do, but it does not work. (From the [] button. AddActionListener (new ActionListener ()) Note: I used ImageIcon to represent my works. Any help?
if ((btnNumber - 1) < 10)
{
if (((btnNumber - 1) % 2) == 0)
{
buttons[btnNumber - 1].setIcon(piece1);
}
else
{
buttons[btnNumber - 1].setIcon(piece2);
}
}
centerPanel.add(buttons[btnNumber - 1]);
}
frame.add(centerPanel, BorderLayout.CENTER);
source
share