The problem is that
Computer_Play()
is a recursive function because it keeps calling itself, and your GUI likely isn't going to update until the function returns (when the computer has finished playing).
So what you might want to do is set up a timer to call a single iteration of the Computer_Play function until the game is over. Kinda like:
timer_tick()
{
boolean end1 =board.Check_GameEnd();
System.out.println(" is game end : =" +end1);
if(!end1 && ((board.P1.turn==true && board.P1.name.matches("Computer")) || (board.P2.turn==true && board.P2.name.matches("Computer"))))
{
Computer_Play();
}
else
{
}
}
And make it so Computer_Play never calls itself.
EDIT: A quick example of using a timer can be found here:
Java Timer Example[
^]
The only difference is that you'd need to execute the function more that once, so you need to use a different overload for the schedule function, or explicitly schedule the next call each time.
Timer myTimer;
...
myTimer = new Timer();
myTimer.schedule(new DoComputerPlay(), 0, 1000);
class DoComputerPlay extends TimerTask
{
public void run()
{
Computer_Play();
if( computer has finished )
myTimer.cancel();
}
}