void (Graphics g, ImageComponent ic) { Dimension size = ic.getCanvasSize(); // Create pattern int cellSize = ic.getTransparencyChessboardCellSize(); int patternSize = 2 * cellSize; if (pattern == null) { pattern = ImageUtil.createImage(g, patternSize, patternSize, BufferedImage.TYPE_INT_ARGB); Graphics imageGraphics = pattern.getGraphics(); imageGraphics.setColor(ic.getTransparencyChessboardWhiteColor()); imageGraphics.fillRect(0, 0, patternSize, patternSize); imageGraphics.setColor(ic.getTransparencyChessboardBlackColor()); imageGraphics.fillRect(0, cellSize, cellSize, cellSize); imageGraphics.fillRect(cellSize, 0, cellSize, cellSize); } ((Graphics2D)g).setPaint(new TexturePaint(pattern, new Rectangle(0, 0, patternSize, patternSize))); g.fillRect(0, 0, size.width, size.height); }