Pages

Close application when click on JFrame close button


*********************************************************
COMPLETE SOURCE CODE FOR : ExitApplicationUsingJFrameCloseButton.java
*********************************************************


import javax.swing.JFrame;

public class ExitApplicationUsingJFrameCloseButton
{
public static void main(String[]args)
{
JFrame a=new JFrame("EXIT AN APPLICATION USING JFRAME CLOSE BUTTON");

//JFrame.EXIT_ON_CLOSE will make your application close when you hit JFrame close button
a.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
a.setSize(200,200);
a.setVisible(true);
}
}


*********************************************************
JUST COMPILE AND EXECUTE IT
*********************************************************
Related Posts Plugin for WordPress, Blogger...