FrameÁ¾·á¸¦ À§ÇÑ ±âº»Àû ±¸ÇöÀ» ÇØ ÁÖ´Â ¿¹Á¦
ExitEventFrame.java
import java.awt.*;
import java.awt.event.*;
public class ExitEventFrame extends Frame implements WindowListener {
public ExitEventFrame () {
this.addWindowListener(this);
}
public void windowClosing(WindowEvent e){
System.exit(0);
}
public void windowActivated(WindowEvent e) {}
public void windowClosed(WindowEvent e) {}
public void windowDeactivated(WindowEvent e) {}
public void windowDeiconified(WindowEvent e) {}
public void windowIconified(WindowEvent e) {}
public void windowOpened(WindowEvent e) {}
public static void main (String[] args) {
ExitEventFrame f = new ExitEventFrame();
f.setSize(200, 200);
f.setBackground(Color.blue);
f.setVisible(true);
}
}
ÇÁ·¹ÀÓ Á¾·á¸¦ À§ÇØ À©µµ¿ì¸®½º³Ê¸¦ ±¸ÇöÇÏ¿© À©µµ¿ì°¡ ´ÝÈú¶§ ÇÁ·Î±×·¥À» Á¾·áÇÏ´Â ¸í·ÉÀ» ÁØ´Ù
public void windowClosing(WindowEvent e){
System.exit(0);
}
jabookÀúÀÚ¸íÇÔ |
Á¦¸ñ:¼Ò¼³°°Àº¹Ì´ÏÄÚµå ÀÛ¼ºÀÚ:Àںϸâ¹ö ±è´ë¼º |