need help plzzz for my question
public void actionPerformed(ActionEvent e) {
for (int i = 0; i < button.length; i++) {
for (int j = 0; j < button[i].length; j++) {
if (e.getSource() == button[i][j]) {
if (b.getBoard()[i][j] instanceof Atom) {
deletA(x, y);
x = i;
y = j;
appearA(x, y);
} else {
if (b.getBoard()[i][j] instanceof Free) {
if (i == x && (j - 1) == y) {
b.move(b.getBoard()[x][y], 'R');
} else if (y == j && (i + 1) == x) {
b.move(b.getBoard()[x][y], 'U');
} else if (i == x && (j + 1) == y) {
b.move(b.getBoard()[x][y], 'L');
} else if (y == j && (i - 1) == x) {
b.move(b.getBoard()[x][y], 'D');
i make an atomic game and create the board by 2 D array and i need when i click at the atom then to click on the free space the atom and the free space will swap each other