public void paintGrid(Graphics g)
		{
		int cw, ch;
		if (renderMode == RenderMode.TILED)
			{
			cw = getWidth();
			ch = getHeight();
			}
		else
			{
			cw = cache.getWidth() * zoom;
			ch = cache.getHeight() * zoom;
			}

		g.setColor(invertGrid ? Color.WHITE : Color.GRAY);

		for (int y = 0; y <= ch; y += zoom)
			g.drawLine(0,y,cw,y);
		for (int x = 0; x <= cw; x += zoom)
			g.drawLine(x,0,x,ch);
		}