title: Fill rectangle with pattern in Java Swing
body: <p>I know how to fill a rectangle in Swing with a solid color:</p>
  
  <pre><code>Graphics2D g2d = bi.createGraphics();
  g2d.setColor(Color.RED);
  g2d.fillRect(0,0,100,100);
  </code></pre>
  
  <p>I know how to fill it with an image:</p>
  
  <pre><code>BufferedImage bi;
  Graphics2D g2d = bi.createGraphics();
  g2d.setPaint (new Color(r, g, b));
  g2d.fillRect (0, 0, bi.getWidth(), bi.getHeight());
  </code></pre>
  
  <p>But how to fill rectangle of size 950x950 with some tiled pattern of size 100x100?</p>
  
  <p><em>(pattern image should be used 100 times)</em></p>