hello sir,
I want to close a frame when I press a button in this frame. Please suggest me how to do so with reference to my program ?
This is my program :
import javax.swing.*;
import java.awt.event.*;
class welcome
{
public static void main(String args[])
{
JFrame frame=new JFrame("Welcome to BANK");
JButton welbutton=new JButton("Click here to Enter PIN");
welbutton.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent ae)
{
JOptionPane.showInputDialog(null, "Enter PIN", "Enter PIN", 1);
}
});
JPanel panel=new JPanel();
panel.add(welbutton);
frame.add(panel);
frame.setSize(1400,100);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOS E);
frame.setVisible(true);
}
}