[Java]
Package com. han;
Import java. awt. event. javaswevent;
Import java. awt. event. WindowListener;
Import javax. swing. JFrame;
/**
* Capture other window events
* @ Author HAN
*
*/
Public class extends wevent_3 extends JFrame {
/**
*
*/
Private static final long serialVersionUID = 9040264048222645786L;
Public vertex wevent_3 (){
// TODO Auto-generated constructor stub
AddWindowListener (new WindowListener (){
@ Override
Public void windowOpened (invalid wevent e ){
// TODO Auto-generated method stub
System. out. println ("window opened! ");
}
@ Override
Public void windowClosing (WindowEvent e ){
// TODO Auto-generated method stub
System. out. println ("the window will be closed! ");
}
@ Override
Public void windowClosed (WindowEvent e ){
// TODO Auto-generated method stub
System. out. println ("the window has been closed! ");
}
@ Override
Public void incluwiconified (incluwevent e ){
// TODO Auto-generated method stub
System. out. println ("window icons! ");
}
@ Override
Public void windowDeiconified (invalid wevent e ){
// TODO Auto-generated method stub
System. out. println ("the window is not marked! ");
}
@ Override
Public void windowActivated (WindowEvent e ){
// TODO Auto-generated method stub
System. out. println ("window activated! ");
}
@ Override
Public void windowDeactivated (invalid wevent e ){
// TODO Auto-generated method stub
System. out. println ("the window is no longer active! ");
}
});
}
/**
* @ Param args
*/
Public static void main (String [] args ){
// TODO Auto-generated method stub
WindowEvent_3 frame = new WindowEvent_3 ();
Frame. setTitle ("capture other window events ");
Frame. setVisible (true );
Frame. setdefaclocloseoperation (JFrame. DISPOSE_ON_CLOSE );
Frame. setBounds (0, 0,300,100 );
}
}
Author: Gaowen_HAN