source: tmcsimulator/trunk/src/tmcsim/simulationmanager/actions/ExitAction.java @ 2

Revision 2, 1.2 KB checked in by jdalbey, 10 years ago (diff)

Initial Import of project files

Line 
1package tmcsim.simulationmanager.actions;
2
3import java.awt.event.ActionEvent;
4
5import javax.swing.AbstractAction;
6import javax.swing.JOptionPane;
7
8import tmcsim.simulationmanager.SimulationManagerView;
9/**
10 * ExitAction is an AbstractAction that is used for exiting the Simulation
11 * Manager application.  When the action is performed, the action prompts the
12 * user to confirm the exit, and then disposes of the SimulationManagerView class.
13 * @author Matthew Cechini
14 */
15@SuppressWarnings("serial")
16public class ExitAction extends AbstractAction {   
17   
18    /** Reference to the SimulationManagerView object. */
19    private SimulationManagerView theSimManagerView = null;
20   
21    /**
22     * Constructor.
23     * @param view View class object for the Simulation Manager.
24     */
25    public ExitAction(SimulationManagerView view) {
26        super("Exit");
27       
28        theSimManagerView = view;       
29    }
30   
31
32    public void actionPerformed(ActionEvent evt) {
33       
34        if(JOptionPane.showConfirmDialog(
35                null, "Exit Simulation Manager?", "Confirm Exit",
36                JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) 
37        {   
38            theSimManagerView.dispose();   
39        }   
40    }
41}
Note: See TracBrowser for help on using the repository browser.