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








Syntax

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

public void componentResized(ComponentEvent e)

Example

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

/*from w  w  w.  ja va 2  s  .  com*/
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;

import javax.swing.JFrame;

public class Main extends ComponentAdapter {


  public void componentResized(ComponentEvent evt) {
    System.out.println("componentResized");
  }

  public static void main(String[] args) {
    JFrame frame = new JFrame("");
    frame.pack();

    frame.addComponentListener(new Main());
    frame.setVisible(true);
  }
}