import java.awt.
Button;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTextArea;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Administrador
*/
public class OperacionesVentanas {
private JFrame ventana = new JFrame();;
public OperacionesVentanas() {
ventana.setTitle("Muestra ventana");
ventana.add(new JTextArea("Esto son operaciones con ventanas"));
ventana.setSize(640, 480);
ventana.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
ventana.setVisible(true);
ventana.addWindowListener(new EscuchaVentana());
}
class EscuchaVentana implements WindowListener{
public void windowActivated(WindowEvent e){
System.out.println("Ventana activada");
}
public void windowClosed(WindowEvent e){
System.out.println("Ventana cerrada");
}
public void windowClosing(WindowEvent e){
System.out.println("Ventana cerrandose");
ventana.dispose();
}
public void windowDeactivated(WindowEvent e){
System.out.println("Ventana desactivada");
}
public void windowDeiconified(WindowEvent e){
System.out.println("Ventana desoculta");
}
public void windowIconified(WindowEvent e){
System.out.println("Ventana oculta");
}
public void windowOpened(WindowEvent e){
System.out.println("ventana abierta");
}
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
new OperacionesVentanas();
}
}