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
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 }