The thing that I need is: do X++ and Y++ of an JButton until "x++ == Z and y++ == W" resulting into an movement of the button...
as far as ive got, first i need to get the coords of the button:
final int locXbtnTrapMe = igu.btnTrapMe.getX();
final int locYbtnTrapMe = igu.btnTrapMe.getY();
then specify the "Z" and "W" which are random limits as next:
int widthTrapMe = igu.btnTrapMe.getWidth();
int heightTrapMe = igu.btnTrapMe.getHeight();
final int randX = random.nextInt(widthMainPanel-widthTrapMe);
final int randY = random.nextInt(heightMainPanel-heightTrapMe);
i specified those randoms like that so that the button doesnt go out of the main pannel... (thing i want)
Now the question: How can i do a ++ every 200ms for both locXbtnTrapMe and locYbtnTrapMe until the randX and randY get reached?
I need a smooth movement of the button from a point to another, not jumps...