i have a GUI where I created a button exitBtn and I want to add the functionality to the button when it is clicked it exits the program.
Below is the code for creating the button and then the second part is the method but I do not know how to code the exit method.
JButton exitBtn = new JButton("Click To Exit");
exitBtn.addActionListener(new ExitAction());
JPanel btn1Panel = new JPanel();
btn1Panel.add(exitBtn);
add(btn1Panel);
private class ExitAction implements ActionListener
{
public void actionPerformed(ActionEvent event)
{
} // end method actionPerformed
} // end class ExitAction