Java move jlabel in animation every 0.5 second -


i want simple animation set location every 0.5 second doesnt animate set location @ end of loop.

int x=1;
int y=1;

while(x<100){  jlabel1.setlocation(x, y);  x=x+10; y=y+10; try{thread.sleep(500);}catch(interruptedexception e){}  } 

i have tried drawing animation thread.sleep() , worked, animated correctly unfortanly not option me need move jlabel around frame wich has figure picture inside it. can pls me problem.

i have tried 2 same result

jlabel1.setbounds(x, y, jlabel1.width,jlabel1.height);  //not working  jlabel1.move(x,y);  //not working  

instead of using java timer try swing timer more suitable swing application.

please have @ how use swing timers

find sample code how fix animation lags in java?


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -