magari ci attacchi un WindowListener e implementi opportunamente windowOpened...