View Javadoc

    1   /*
    2    * @(#) PanUpAction.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  import javax.swing.Action;
    16  import javax.swing.ImageIcon;
    17
    18  import nl.tudelft.simulation.dsol.gui.animation2D.GridPanel;
    19  import nl.tudelft.simulation.language.io.URLResource;
    20
    21  /***
    22   * @author peter
    23   */
    24  public class HomeAction extends AbstractAction
    25  {
    26  	/*** target of the gridpanel */
    27  	private GridPanel target = null;
    28
    29  	/***
    30  	 * constructs a new ZoomIn
    31  	 *
    32  	 * @param target the target
    33  	 */
    34  	public HomeAction(final GridPanel target)
    35  	{
    36  		super("Home");
    37  		this.target = target;
    38  		this.putValue(Action.SMALL_ICON, new ImageIcon(URLResource
    39  				.getResource("/toolbarButtonGraphics/navigation/Home16.gif")));
    40  		this.setEnabled(true);
    41  	}
    42
    43  	/***
    44  	 * @see java.awt.event.ActionListener
    45  	 *      #actionPerformed(java.awt.event.ActionEvent)
    46  	 */
    47  	public void actionPerformed(final ActionEvent actionEvent)
    48  	{
    49  		this.target.home();
    50  		this.target.requestFocus();
    51  	}
    52  }