1
2
3
4
5
6
7
8
9
10 package nl.tudelft.simulation.dsol.gui.menu.actions;
11
12 import java.awt.event.ActionEvent;
13 import java.awt.event.InputEvent;
14 import java.awt.event.KeyEvent;
15
16 import javax.swing.AbstractAction;
17 import javax.swing.Action;
18 import javax.swing.KeyStroke;
19
20 import nl.tudelft.simulation.dsol.gui.DSOLApplicationInterface;
21
22 /***
23 * The Exit action <br>
24 * (c) copyright 2003 <a href="http://www.simulation.tudelft.nl">Delft
25 * University of Technology </a>, the Netherlands. <br>
26 * See for project information <a
27 * href="http://www.simulation.tudelft.nl">www.simulation.tudelft.nl </a> <br>
28 * License of use: <a href="http://www.gnu.org/copyleft/gpl.html">General Public
29 * License (GPL) </a>, no warranty <br>
30 *
31 * @version 1.0 18.10.2003 <br>
32 * @author <a href="http://www.simulation.tudelft.nl/people/jacobs.html">Peter
33 * Jacobs </a>
34 */
35
36 public class ExitAction extends AbstractAction
37 {
38 /*** the parent */
39 private DSOLApplicationInterface application = null;
40
41 /***
42 * constructs a new OpenFileAction
43 *
44 * @param application the parent application
45 */
46 public ExitAction(final DSOLApplicationInterface application)
47 {
48 super("Exit");
49 this.application = application;
50 this.putValue(Action.MNEMONIC_KEY, new Integer('O'));
51 this.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(
52 KeyEvent.VK_F4, InputEvent.ALT_DOWN_MASK));
53 this.setEnabled(true);
54 }
55
56 /***
57 * @see java.awt.event.ActionListener
58 * #actionPerformed(java.awt.event.ActionEvent)
59 */
60 public void actionPerformed(final ActionEvent event)
61 {
62 this.application.notify();
63
64 }
65 }