Java Swing Tutorial - Java ComponentEvent COMPONENT_HIDDEN








Syntax

ComponentEvent.COMPONENT_HIDDEN has the following syntax.

public static final int COMPONENT_HIDDEN

Example

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

//from   w w  w . ja  v  a 2 s .c  o m
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;

import javax.swing.JFrame;

public class Main implements ComponentListener {

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

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


}