if (tsize.width <= 0 || tsize.height <= 0) return;
if (tsize.width <= 0 || tsize.height <= 0) { return; }
    protected void paintGrid(Graphics2D g2d) {        // Determine tile size        Dimension tsize = getTileSize();        if (tsize.width <= 0 || tsize.height <= 0) return;        // Determine lines to draw from clipping rectangle        Rectangle clipRect = g2d.getClipBounds();        int startX = clipRect.x / tsize.width * tsize.width;        int startY = clipRect.y / tsize.height * tsize.height;        int endX = clipRect.x + clipRect.width;        int endY = clipRect.y + clipRect.height;        for (int x = startX; x < endX; x += tsize.width) {            g2d.drawLine(x, clipRect.y, x, clipRect.y + clipRect.height - 1);        }        for (int y = startY; y < endY; y += tsize.height) {            g2d.drawLine(clipRect.x, y, clipRect.x + clipRect.width - 1, y);        }    }