Hello programmers,
Im trying to make a jLabel ( with an image in it )move in netbeans, but with my current code it moves -5 every ''act?''. I would like to add a delay to it so that it moves -5, then it waits for example 0.5 seconds, and continues. I treid methods like, sleep and wait but i got errors every time. Is there any other way to do it? Or how do i correct use these methods
My code :
This is is executed when a certain buttom is preshed : move(-5, 0, 10);
public void move(int xx, int yy, int ii) { for (int i = 0; i < ii; i++) { x = mario.getX() + xx; y = mario.getY() + yy; mario.setBounds(x, y, 91, 117); } }
Many thanks in advance!