g2D.drawString(s, x+l/2-size/2+1, y-hFont);
g2D.drawString(s, x+(l-fontMetrics.stringWidth(s))/2+1, y-hFont);
    private void paintScaleBar(Graphics2D g2D, int x, int y, int l,                                 String s)    {        FontMetrics fontMetrics = g2D.getFontMetrics();        int hFont = fontMetrics.getHeight()/3;        int size = s.length()*charWidth;        g2D.setColor(UNIT_BAR_COLOR);        g2D.drawString(s, x+l/2-size/2+1, y-hFont);        g2D.setStroke(UNIT_BAR_STROKE);        g2D.drawLine(x, y, x+l, y);    }