Java: Cannot make a static reference to the non-static method createImage(int, int) from the type Component
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/4969171/cannot-make-a-static-reference-to-the-non-static-method">Cannot make a static reference to the non-static method</a>  </p>
</blockquote>



<p>I am trying to tile a background, but now I am stuck. I have read the documentation for <code>createImage()</code>, but for some reason something is static, and I can't figure out how or why.</p>

<p>Here is the code I have:</p>

<pre><code>Paint paint;

    if (paint == null) {
        try {
            // Create TexturePaint instance the first time
            Component c;

            Image image = c.getToolkit().getImage("Background.png");

            int height = image.getHeight(null);
            int width = image.getWidth(null);

            BufferedImage bi = (BufferedImage) Component.createImage(width, height);
            Graphics2D biG2d = (Graphics2D) bi.getGraphics();

            biG2d.drawImage(image, 0, 0, Color.black, null);

            paint = new TexturePaint(bi, new Rectangle(0, 0, width, height));
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
</code></pre>

<p>I couldn't find a single answer on the internet, so I don't know what's going wrong. :(</p>

<p>Thank you very much for your support.</p>
