Java Swing Tutorial - Java ComponentEvent COMPONENT_LAST








Syntax

ComponentEvent.COMPONENT_LAST has the following syntax.

public static final int COMPONENT_LAST

Example

In the following code shows how to use ComponentEvent.COMPONENT_LAST field.

import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
/*from w ww  .j a  v  a  2  s  .co  m*/
import javax.swing.JFrame;

public class Main implements ComponentListener {

  @Override
  public void componentShown(ComponentEvent evt) {
    System.out.println(evt.getID()== ComponentEvent.COMPONENT_LAST);
  }
  @Override
  public void componentResized(ComponentEvent e) {
    
  }
  @Override
  public void componentMoved(ComponentEvent e) {
  }
  @Override
  public void componentHidden(ComponentEvent e) { 
  }
  public static void main(String[] args) {
    JFrame frame = new JFrame("");
    frame.pack();

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


}