Ignore:
Timestamp:
04/26/2016 07:26:04 AM (10 years ago)
Author:
jdalbey
Message:

CADSimulatorViewer - Add accelerator key to Exit menu item, and remove confirmation prompting when Exit chosen.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/tmcsim/cadsimulator/viewer/actions/ExitAction.java

    r2 r24  
    22 
    33import java.awt.event.ActionEvent; 
    4  
    54import javax.swing.AbstractAction; 
    6  
    75import tmcsim.cadsimulator.viewer.CADSimulatorViewer; 
    86 
    97/** 
    10  * Abstract action to exit the CADSimulator. When the action is performed 
    11  * the CADSimulatorView.closeViewer() method is called. 
    12  *   
     8 * Abstract action to exit the CADSimulator. When the action is performed the 
     9 * CADSimulatorView.closeViewer() method is called. 
     10 * 
    1311 * @author Matthew Cechini 
    14  * @version  
     12 * @version 
    1513 */ 
    1614@SuppressWarnings("serial") 
    17 public class ExitAction extends AbstractAction { 
     15public class ExitAction extends AbstractAction 
     16{ 
    1817 
    19     /** Reference to the CADSimulatorViewer. */ 
     18    /** 
     19     * Reference to the CADSimulatorViewer. 
     20     */ 
    2021    private CADSimulatorViewer theViewer; 
    2122 
    22     public ExitAction(CADSimulatorViewer viewer) { 
     23    public ExitAction(CADSimulatorViewer viewer) 
     24    { 
    2325        super("Exit"); 
    24          
     26 
    2527        theViewer = viewer; 
    2628    } 
    27      
    28     public void actionPerformed(ActionEvent arg0) {      
    29         theViewer.closeViewer(); 
     29 
     30    public void actionPerformed(ActionEvent arg0) 
     31    { 
     32        //theViewer.closeViewer(); 
     33        /* closeViewer() will prompt the user for confirmation. 
     34         * 26 Apr 2016 I'm tired of seeing the confirmation message, 
     35         * so if the user chooses File>Exit, assume they intend to exit 
     36         * and don't ask for confirmation.  If they click window close 
     37         * button, they will still get the confirmation prompt. jdalbey 
     38         */ 
     39        System.exit(0); 
    3040    } 
    31  
    3241} 
Note: See TracChangeset for help on using the changeset viewer.