1 package nl.tudelft.simulation.dsol.swing.animation.d2.actions;
2
3 import java.awt.event.ActionEvent;
4
5 import javax.swing.AbstractAction;
6 import javax.swing.Action;
7 import javax.swing.ImageIcon;
8
9 import org.djutils.io.URLResource;
10
11 import nl.tudelft.simulation.dsol.swing.animation.d2.VisualizationPanel;
12
13
14
15
16
17
18
19
20
21
22
23
24 public class PanUpAction extends AbstractAction
25 {
26
27 private static final long serialVersionUID = 20140909L;
28
29
30 private VisualizationPanel panel = null;
31
32
33
34
35
36 public PanUpAction(final VisualizationPanel panel)
37 {
38 super("PanUp");
39 this.panel = panel;
40 this.putValue(Action.SMALL_ICON, new ImageIcon(URLResource.getResource("/toolbarButtonGraphics/navigation/Up16.gif")));
41 this.setEnabled(true);
42 }
43
44
45
46
47 @Override
48 public void actionPerformed(final ActionEvent actionEvent)
49 {
50 this.panel.pan(VisualizationPanel.UP, 0.1);
51 this.panel.requestFocus();
52 }
53 }