I need to perform a method after the clicking of a JButton in a Java Project. I'm making a client-server game and after the click of a button I need that the client/server start to wait untill the opponent perform a click. The problem is that at the end of the action listener code I start a loop end untill the opponent don't perform another click the jbutton stays clicked..
public void actionPerformed(ActionEvent e) {
JButton o = (JButton)e.getSource();
String name = o.getName().substring(3);
Click(Integer.parseInt(name));
if(isServer)
ListenServer();
else
ListeClient();
}
ListenServer() and ListenClient() are two loop function... How can I call this methods AFTER the click??? Thanks and sorry for the bad english