Example 6 Given that the roots of the equation $x^{2}-(k+3) x+k^{2}=0$ are integers. Find the integer value of $k$ and the roots of the equation.
$$
\text { Sol: } \begin{aligned}
\Delta & =[-(k+3)]^{2}-4 k^{2} \\
& =-3 k^{2}+6 k+9 \geqslant 0 \\
\Rightarrow k^{2} & -2 k-3 \leqslant 0 \Rightarrow-1 \leqslant k \leqslant 3
\end{aligned}
$$
$\Rightarrow$ integers $k=-1,0,1,2,3$.
By the quadratic formula, $x=\frac{(k+3) \pm \sqrt{\Delta}}{2}$, so
when $k=-1$, $\Delta=0, x=1$;
when $k=0$, $\Delta=9, x=0$ or 3;
when $k=1$, $\Delta=12$ is not a perfect square, no integer root $x$ exists;
when $k=2$, $\Delta=9, x=1$ or 4;
when $k=3$, $\Delta=0, x=3$.
Therefore, $k=-1,0,2,3, x=1,0,3,4$.