void computeBoardScale()
    {
        Dimension target = new Dimension(1500, 1500);
        Dimension container = this.getSize();
        Double s = 1.0;
        if ( ( target.width <= container.width ) && ( target.height <= container.height ) )
            {} // It already fits in container
        else if ( (target.width > container.width) && (target.height <= container.height) )
            s = (double)container.width / (double)target.width; // It does not fit horizontaly
        else if ( (target.width <= container.width) && (target.height > container.height) )
            s = (double)container.height / (double)target.height; // It does not fit verticaly
        else if(target.width == target.height)
        {
            if(container.width <= container.height)
                s = (double)container.width / (double)target.width;
            else
                s = (double)container.height / (double)target.height;
        }
        
        Dimension scaled = new Dimension((int)(target.width * s), (int)(target.height * s));
        this.board.setPreferredSize(scaled);

        this.boardScale = s;
        this.origX = (container.width - scaled.width) / 2;
        this.origY = (container.height - scaled.height) / 2;

        Dimension ballSize = new Dimension((int)(100.0 * s), (int)(100.0 * s));
        this.whiteBall.setPreferredSize(ballSize);
        this.blackBall.setPreferredSize(ballSize);
        this.selection.setPreferredSize(ballSize);
    }