static void paintTiledBackground(Component c, Graphics g, BufferedImage tileImage) { int width = c.getWidth(); int height = c.getHeight(); for (int x = 0; x < width; x += tileImage.getWidth()) for (int y = 0; y < height; y += tileImage.getHeight()) g.drawImage(tileImage, x, y, c); }