Hello, I have to code a rock, paper scissors GUI program with Java Swing using window builder on Eclipse.
I'm currently trying to figure out how to get user input and respond accordingly. I have 4 buttons; next round, rock, paper, and scissors. I only want either rock, paper scissors to do something only once for every round. However, right now I have an action listener on each of the buttons; rock, paper scissors, and it's responding to the action even though the user has not clicked next round each round.
This is the way I implemented for each button
btnRock.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
//stuff
}
});
Anyone have any recommended way of handling user input on a conditional basis?
Thx in advance