public void drawValues(Graphics g, String s, double hs) {
        if (s == null) {
            return;
        }
        g.setFont(unitsFont);
        FontMetrics fm = g.getFontMetrics();
        int w = fm.stringWidth(s);
        g.setColor(whiteColor);
        int ya = fm.getAscent() / 2;
        int xc, yc;
        if (this instanceof RailElm || this instanceof SweepElm) {
            xc = x2;
            yc = y2;
        } else {
            xc = (x2 + x) / 2;
            yc = (y2 + y) / 2;
        }
        int dpx = (int) (dpx1 * hs);
        int dpy = (int) (dpy1 * hs);
        if (dpx == 0) {
            g.drawString(s, xc - w / 2, yc - abs(dpy) - 2);
        } else {
            int xx = xc + abs(dpx) + 2;
            if (this instanceof VoltageElm || (x < x2 && y > y2)) {
                xx = xc - (w + abs(dpx) + 2);
            }
            g.drawString(s, xx, yc + dpy + ya);
        }
    }