I have to solve this integral: $$ \frac{1}{\pi}\int_{\theta_1}^{\theta_2}\sqrt{\Gamma^2 - \frac{J^2}{\sin^2(\theta)}}\text{d}\theta, $$ where $\theta_1$ and $\theta_2$ are the endpoints of one of the intervals where the integrand function is defined, so - for example - $\theta_1 = \arcsin(J/\Gamma)$ and $\theta_2 = \arcsin(-J/\Gamma)+\pi$, if $J > 0$.
$\Gamma$ and $J$ are real values chosen such that the previous expressions are well defined.
The solution should be $\Gamma-|J|$. Is there any change of variable or technique useful in solving it?
Denote $a=(J/\Gamma)^2$, substitute $t=\sin^2\theta$ and use the symmetry w.r.t. $\theta\mapsto\pi-\theta$: $$I=\frac\Gamma\pi\int_a^1\sqrt{\frac{t-a}{1-t}}\frac{dt}{t}.$$
Now try $(t-a)/(1-t)=z$, i.e. $t=(a+z)/(1+z)$. You get $$I=\frac\Gamma\pi\int_0^\infty\frac{(1-a)\sqrt{z}\,dz}{(a+z)(1+z)}=\frac\Gamma\pi\int_0^\infty\left(\frac1{1+z}-\frac{a}{a+z}\right)\frac{dz}{\sqrt{z}}.$$
And now the (elementary) integration is easy: $$I=\frac{2\Gamma}\pi\left(\arctan\sqrt{z}-\sqrt{a}\arctan\sqrt{z/a}\right)_{z=0}^{z=\infty}=(1-\sqrt{a})\Gamma.$$
Which matches your expected result.