Java tutorial
import java.awt.event.ComponentAdapter; import java.awt.event.ComponentEvent; import javax.swing.JFrame; public class Main extends ComponentAdapter { public void componentShown(ComponentEvent evt) { System.out.println("componentShown"); } public static void main(String[] args) { JFrame frame = new JFrame(""); frame.pack(); frame.addComponentListener(new Main()); frame.setVisible(true); } }