Where it says: usePanel.setLocation(800,usePanel.getY()); it doesn\'t set the location it just starts in the middle, but inside the for loop where it gradually changes the p
Why you think it is not working? Probably you cannot just notice it. After your first setPosition() add following code:
setPosition()
Thread.sleep(3000);
Then you will notice it.