title: How do I to make a sprite move using a timer in java?
body: <p>Well, I'm very(meaning just started a few months ago) new to Programming, I'm learning java. </p>
  
  <p>Anyway, How do I make a sprite move using a timer say:</p>
  
  <pre><code>  private Timer timer = new Timer(5000,this);
  </code></pre>
  
  <p>and a Sprite like this:</p>
  
  <pre><code>    private JLabel player = new JLabel(new ImageIcon("Sprites/apple.png"));
  </code></pre>
  
  <p>With a constructor like this:</p>
  
  <pre><code> public timing()
  {
      Container c = getContentPane();
      c.setLayout(null);
      setVisible(true);
      setSize(1280,720);
      player.setBounds(x,y,100,100); //Use this for moving!
      c.add(player);
  
      timer.start();
      addKeyListener(
          new KeyAdapter(){
  
          public void keyPressed(KeyEvent e){
                  String key = e.getKeyText(e.getKeyCode());
                  if(key.equals("Down"))
                  {
                    What Do I put Here?
                  }}});
  
  
  }
  </code></pre>
  
  <p>So every second, the sprite</p>
  
  <pre><code>  player
  </code></pre>
  
  <p>will move like </p>
  
  <pre><code>  x+=5 and y+=5
  </code></pre>
  
  <p>While I am using</p>
  
  <pre><code>  public void paint(Graphics g)
  {
      super.paint(g);
      player.setBounds(x,y,100,400);
  }
  </code></pre>
  
  <p>(I'm very sorry for I'm just a kid learning JAVA)</p>