public void paintComponent(Graphics gr) {
        Graphics2D g = (Graphics2D) gr;
        g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        if(bg == null) bg = background;
        g.drawImage(bg, 0, 0, w, h, null);
        paintBorders(g);
    }