The definition of AWT "visible" may be a bit controversial. From Javadoc java.awt.Component # isVisible:
"Components are initially visible, with the exception of top level components such as
Frame objects."
In accordance with this description p is already visible before you add the ComponentListener. In fact, you can verify this if you insert a
System.out.println(p.getVisible());
, f.setVisible(true). , , , componentShown (..) .
Thomas