// is too slow and can't be replaced by Quartz engine in applet environment
int imageWidth = Math.round(mainGridSize * gridScale);
BufferedImage gridImage = new BufferedImage(imageWidth, imageWidth, BufferedImage.TYPE_INT_ARGB);
Graphics2D imageGraphics = (Graphics2D)gridImage.getGraphics();
setRenderingHints(imageGraphics);
imageGraphics.scale(gridScale, gridScale);
paintGridLines(imageGraphics, gridScale, 0, mainGridSize, 0, mainGridSize, gridSize, mainGridSize);
imageGraphics.dispose();
g2D.setPaint(new TexturePaint(gridImage, new Rectangle2D.Float(0, 0, mainGridSize, mainGridSize)));