Chess game selection screen
I am making a chess game with Java. I am not tackling chess AI - the game simply enforces the rules of chess for two human players.
Each chess square is a JLabel with a MouseListener which calls the squareClicked(clickedPosition) method in my GameController class. I have implemented almost the whole game of chess like this, but I'm now stuck when trying to implement one of the final features.
When a pawn reaches the final square, I want a window to pop-up with some radio buttons so that the user can choose a replacement piece like a queen. It needs to work so that if the user tries to click on the chessboard whilst the window is still there, nothing should happen. Players should not be allowed to move until the replacement piece has been chosen.
So the window needs to appear, the user should click a radio button for their desired piece, and then click ok. The window should then disappear, and my gamecontroller object needs to somehow be notified about their selection, so that it can replace the pawn with their selected piece and continue the game.
I am not sure how to approach this. Sound like I may need to launch the window with a new thread, and join my main thread to the end of it. Or perhaps make my gamecontroller object wait(). However I am very inexperienced with threading and need some guidance.