Java Swing Tutorial - Java ComponentAdapter() Constructor








Syntax

ComponentAdapter() constructor from ComponentAdapter has the following syntax.

public ComponentAdapter()

Example

In the following code shows how to use ComponentAdapter.ComponentAdapter() constructor.

// w w w.  j  a v  a 2 s  . 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);
  }
}