if (tsize.width <= 0 || tsize.height <= 0) return;
if (tsize.width <= 0 || tsize.height <= 0) { return; }
    protected void paintCoordinates(Graphics2D g2d) {        Dimension tsize = getTileSize();        if (tsize.width <= 0 || tsize.height <= 0) return;        g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,                RenderingHints.VALUE_TEXT_ANTIALIAS_ON);        // Determine tile size and offset        Font font = new Font("SansSerif", Font.PLAIN, tsize.height / 4);        g2d.setFont(font);        FontRenderContext fontRenderContext = g2d.getFontRenderContext();        // Determine area to draw from clipping rectangle        Rectangle clipRect = g2d.getClipBounds();        int startX = clipRect.x / tsize.width;        int startY = clipRect.y / tsize.height;        int endX = (clipRect.x + clipRect.width) / tsize.width + 1;        int endY = (clipRect.y + clipRect.height) / tsize.height + 1;        // Draw the coordinates        int gy = startY * tsize.height;        for (int y = startY; y < endY; y++) {            int gx = startX * tsize.width;            for (int x = startX; x < endX; x++) {                String coords = "(" + x + "," + y + ")";                Rectangle2D textSize =                    font.getStringBounds(coords, fontRenderContext);                int fx = gx + (int)((tsize.width - textSize.getWidth()) / 2);                int fy = gy + (int)((tsize.height + textSize.getHeight()) / 2);                g2d.drawString(coords, fx, fy);                gx += tsize.width;            }            gy += tsize.height;        }    }