paintScaleBar(g2D, img.getWidth()-size-5,
paintScaleBar(g2D, img.getWidth()-size-10,
    public void paintComponent(Graphics g)    {        super.paintComponent(g);        Graphics2D g2D = (Graphics2D) g;                g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING,                            RenderingHints.VALUE_ANTIALIAS_ON);        g2D.setRenderingHint(RenderingHints.KEY_RENDERING,                            RenderingHints.VALUE_RENDER_QUALITY);        g2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION,                            RenderingHints.VALUE_INTERPOLATION_BILINEAR);        BufferedImage img = model.getDisplayedImage();        if (img == null) return;        //paintXYFrame(g2D);        g2D.drawImage(img, null, 0, 0);          double v = model.getPixelsSizeX()/model.getZoomFactor();        v *= model.getUnitBarSize();        String value;        double c = v;        if (Math.ceil(v) == c) value = ""+(int) c;        else value = ""+c;        int size = (int) model.getUnitBarSize();        if (v > 0 && model.isUnitBar()) {            paintScaleBar(g2D, img.getWidth()-size-5,                         img.getHeight()-10, size, value);        }    }