1
2
3
4
5
6
7
8
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 }