title: Java - How to move a rectangle that's drawn by Graphics2D?
body: <p>I'm trying to move a rectangle drawn by Graphics2D over, but it just doesn't work. When I do x += 1; It actually moves it 1 pixel over and stops. if I do say, x += 200; It moves it 200 pixels over ONCE not in every update, but ONCE.</p>
  
  <pre><code>public void paint(Graphics g)
  {
      super.paint(g);
  
      g.setColor(Color.WHITE);
      g.fillRect(0, 0, this.getWidth(), this.getHeight());
  
      g.setColor(Color.RED);
      g.fillRect(x, 350, 50, 50);
  
      x += 1;
  }
  </code></pre>
  
  <p>int x is called outside void paint to make sure it's not incremented as 150 each time.
  Draws fine, just doesn't move, I tried using a thread and using a while loop so while the thread is running, it moves, but no luck.</p>