By
Using windowLister we can close the window.
myFrame.addWindowListener(new
WindowAdapter(){
public void windowClosing(WindowEvent we){
System.exit(0);
}
});
import java.awt.*; import java.awt.event.*; class WindowClose{ Frame myFrame; void display(){ myFrame = new Frame("Add Popup Menu"); myFrame.setVisible(true); myFrame.setSize(250, 250); myFrame.addWindowListener(new WindowAdapter(){ public void windowClosing(WindowEvent we){ System.exit(0); } }); } public static void main(String args[]){ ComponentAdd obj1 = new ComponentAdd(); obj1.display(); } }
No comments:
Post a Comment