"JUMP" in a java 2d game
<p>I have this code and I wanted to initiate a jump in a java 2d game,the thing is that my object doesnt goes anywhere,it just stays there...i wanted my object to jump as i press the key and the programme to show me images moving up and down..i am trying to do this by simple repaint() method
CODE::::</p>

<pre><code>    public void actionPerformed(ActionEvent e) {
    if(hero.jump()==1){
    int jumpheight=40,j=0;
    while(j&lt;jumpheight){
        hero.y--;             \\changing the y position (up)..
            try {
            Thread.sleep(100);
        } catch (InterruptedException e1) {}
        repaint(); 
        j++;
    }
    j=0;
    hero.jump1=0;
    while(j&lt;jumpheight){
        hero.y++;               \\changing the y position (down)..
            try {
            Thread.sleep(100);
        } catch (InterruptedException e1) {}
        repaint(); 
        j++;
    }
    }
    else {
    hero.move();
    repaint();  
    }
</code></pre>
