************************************************************************
COMPLETE SOURCE CODE FOR : ClosingAJWindowUsingButton.java
************************************************************************
import javax.swing.JWindow;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.FlowLayout;
public class ClosingAJWindowUsingButton extends JWindow implements ActionListener
{
JButton button=new JButton("Exit");
public ClosingAJWindowUsingButton()
{
button.addActionListener(this);
setLayout(new FlowLayout());
add(button);
setSize(400,400);
setVisible(true);
}
public void actionPerformed(ActionEvent evt)
{
if(evt.getSource()==button)
{
System.exit(0);
}
}
public static void main(String[]args)
{
ClosingAJWindowUsingButton caj=new ClosingAJWindowUsingButton();
}
}
************************************************************************
JUST COMPILE AND EXECUTE IT
************************************************************************