View Javadoc

1   /*
2    * @(#) ExitAction.java Oct 23, 2003
3    * 
4    * Copyright (c) 2002-2005 Delft University of Technology Jaffalaan 5, 2628 BX
5    * Delft, the Netherlands. All rights reserved.
6    * 
7    * This software is proprietary information of Delft University of Technology
8    * The code is published under the Lesser General Public License
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 2002-2005 <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/lesser.html">Lesser
29   * General Public License (LGPL) </a>, no warranty.
30   * 
31   * @version $Revision$ $Date$
32   * @author <a href="http://www.tbm.tudelft.nl/webstaf/peterja">Peter Jacobs </a>
33   */
34  
35  public class ExitAction extends AbstractAction
36  {
37  	/*** the parent */
38  	private DSOLApplicationInterface application = null;
39  
40  	/***
41  	 * constructs a new OpenFileAction
42  	 * 
43  	 * @param application the parent application
44  	 */
45  	public ExitAction(final DSOLApplicationInterface application)
46  	{
47  		super("Exit");
48  		this.application = application;
49  		this.putValue(Action.MNEMONIC_KEY, new Integer('O'));
50  		this.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(
51  				KeyEvent.VK_F4, InputEvent.ALT_DOWN_MASK));
52  		this.setEnabled(true);
53  	}
54  
55  	/***
56  	 * @see java.awt.event.ActionListener
57  	 *      #actionPerformed(java.awt.event.ActionEvent)
58  	 */
59  	public void actionPerformed(final ActionEvent event)
60  	{
61  		this.application.notify();
62  		// TODO
63  	}
64  }