View Javadoc

    1   /*
    2    * @(#) ShowGridAction.java Oct 29, 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.animation2D.actions;
    11
    12  import java.awt.event.ActionEvent;
    13
    14  import javax.swing.AbstractAction;
    15
    16  import nl.tudelft.simulation.dsol.gui.animation2D.GridPanel;
    17
    18  /***
    19   * @author peter
    20   */
    21  public class ShowGridAction extends AbstractAction
    22  {
    23  	/*** target of the gridpanel */
    24  	private GridPanel target = null;
    25
    26  	/***
    27  	 * constructs a new AddRowAction
    28  	 *
    29  	 * @param target the target
    30  	 */
    31  	public ShowGridAction(final GridPanel target)
    32  	{
    33  		super("ShowGrid");
    34  		this.target = target;
    35  		this.setEnabled(true);
    36  	}
    37
    38  	/***
    39  	 * @see java.awt.event.ActionListener
    40  	 *      #actionPerformed(java.awt.event.ActionEvent)
    41  	 */
    42  	public void actionPerformed(final ActionEvent actionEvent)
    43  	{
    44  		this.target.showGrid(!this.target.isShowGrid());
    45  		this.target.requestFocus();
    46  	}
    47  }