Java Swing Tutorial - Java ComponentAdapter .componentShown (ComponentEvent e)








Syntax

ComponentAdapter.componentShown(ComponentEvent e) has the following syntax.

public void componentShown(ComponentEvent e)

Example

In the following code shows how to use ComponentAdapter.componentShown(ComponentEvent e) method.

/* w  w w  . ja v a  2s.  c o  m*/
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);
  }
}