title: java canvas drawstring
body: <p>I am wanting a string to be drawn at a random position, then jump to a new position but leave an imprint of itself behind.</p>
  
  <p>There does not appear to be a "stamp" command in java.</p>
  
  <p>How can I do it?</p>
  
  <p>So far I only have a random character that jumps but does not leave a copy of itself behind.</p>
  
  <pre><code>import java.awt.Canvas;
  import java.awt.Graphics;
  import java.util.Random;
  
  import javax.swing.JFrame;
  
  @SuppressWarnings("serial")
  public class test extends Canvas {
  
  private static Random random = new Random();
  
  public void paint(Graphics g) {
      g.drawString("X", random.nextInt(10) * 10, random.nextInt(10) * 10);
  
      try {
          Thread.sleep(250);
      } catch (Exception e ) {}
  
      repaint();
  }
  
  public static void main(String[] argS) {
      test canvas = new test();
      JFrame frame = new JFrame();
      frame.add(canvas);
      frame.setSize(300, 300);
      frame.setVisible(true);
      frame.setLocationRelativeTo(null);
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  }
  }
  </code></pre>