Step 1: Apply the king's-rule property first, exactly as before, to remove the $x$ from the numerator:
Let $I=\displaystyle\int_0^\pi\dfrac{x\,dx}{a^2\cos^2x+b^2\sin^2x}$. Using $x\to\pi-x$ and noting $\cos^2(\pi-x)=\cos^2x$, $\sin^2(\pi-x)=\sin^2x$, adding gives $2I=\pi\displaystyle\int_0^\pi\dfrac{dx}{a^2\cos^2x+b^2\sin^2x}$.
Step 2: Evaluate the remaining integral $J$ using the direct substitution $t=\tan x$ rather than quoting the standard result:
On $[0,\pi/2]$, divide numerator and denominator by $\cos^2x$: $J_1=\displaystyle\int_0^{\pi/2}\dfrac{\sec^2x\,dx}{a^2+b^2\tan^2x}$. With $t=\tan x$, $dt=\sec^2x\,dx$, and limits $0\to\infty$: $J_1=\displaystyle\int_0^\infty\dfrac{dt}{a^2+b^2t^2}=\dfrac{1}{ab}\left[\tan^{-1}\left(\dfrac{bt}{a}\right)\right]_0^\infty=\dfrac{1}{ab}\cdot\dfrac{\pi}{2}=\dfrac{\pi}{2ab}$.
Step 3: Double this for the full $[0,\pi]$ range using the mirror symmetry about $\pi/2$:
$J=2J_1=\dfrac{\pi}{ab}$.
Step 4: Substitute back to find $I$:
$2I=\pi\cdot\dfrac{\pi}{ab}=\dfrac{\pi^2}{ab} \Rightarrow I=\dfrac{\pi^2}{2ab}$.
Final Answer:
$I=\dfrac{\pi^2}{2ab}$.
\[ \boxed{\dfrac{\pi^2}{2ab}} \]