Hi everyone. I am working on a Java project for college, and am pretty stuck on this issue.

I have to make a working game, called "Breakthrough." It's basically chess, but all you have are pawns. The rules of the game aren't relevant to my question.

Right now I have 4 classes:

Piece: has a team name (String).

Space: extends JButton, has a label (String), row and column (ints), and a boolean 'occupied' variable to tell whether there is a Piece on the Space. Has 2 constructors: one for making a Space with no Piece on it, one for making a Space with a Piece on it.

BreakthroughGame: constructs a 2-dimensional array of Spaces, using nested for loops. Depending on which column the Space is being placed in, either a Space with a Piece or without a Piece will be made. This class also defines all the rules for movement, in a method called move(), with two Spaces as parameters (the starting Space and the ending Space).

BreakthroughGUI: Creates the GUI for the game. It retrieves each Space from BreakthroughGame's 2D array of Spaces and places them in the GUI (since Space extends JButton, they are all Swing components).

Now here's my problem. The way I want the players to move is by clicking a Space with a Piece on it, then clicking the Space where they want that Piece to move. But I can't figure out how to wait for a second button click so I can pass the two Spaces into the move() method.

Any help with this would be awesome.