ive got a program that needs to loop until either of it's provided integers equal 0, once one does it returns a boolean showing which one(true mean i is 0, false means x is 0) my issue is i need to display this information on a canvas but when a while loop is running it seems to stop it from animating. Animation works fine without the while loop but i need it to do the math.
time=new Timer(400,paintCaller);
time.start();
while(i>0 && x>0)
{
i-=2;
x--;
try
{
Thread.sleep(1000);
}catch(Exception e){}
if(i<=0)
{
return true;
}else
{
return false;
}
}
the issue with this one is that when the while loop runs it for some reason stops my timer from calling PaintCaller.
while(i>0 && x>0)
{
repaint();
i-=2;
x--;
try
{
Thread.sleep(1000);
}catch(Exception e){}
if(i<=0)
{
return true;
}else
{
return false;
}
}
for some reason here, repaint never gets called. (These are 2 seperate codes that i have tried neither work)
I think the while loop messes with the paint method somehow. can anybody help i really want to finish my game, this is the last thing i have to do for it XD