1 package org.opentrafficsim.swing.graphs;
2
3 import java.awt.event.ActionEvent;
4 import java.awt.event.ActionListener;
5
6 import javax.swing.JCheckBoxMenuItem;
7 import javax.swing.JPopupMenu;
8
9 import org.opentrafficsim.draw.graphs.AbstractSpaceTimePlot;
10
11
12
13
14
15
16
17
18
19
20
21 public class SwingSpaceTimePlot extends SwingPlot
22 {
23
24
25 private static final long serialVersionUID = 20190823L;
26
27
28
29
30
31 public SwingSpaceTimePlot(final AbstractSpaceTimePlot plot)
32 {
33 super(plot);
34 }
35
36 @Override
37 protected void addPopUpMenuItems(final JPopupMenu popupMenu)
38 {
39 JCheckBoxMenuItem fixedDomainCheckBox = new JCheckBoxMenuItem("Fixed time range", false);
40 fixedDomainCheckBox.addActionListener(new ActionListener()
41 {
42 @Override
43 public void actionPerformed(final ActionEvent e)
44 {
45 boolean fixed = ((JCheckBoxMenuItem) e.getSource()).isSelected();
46 getPlot().updateFixedDomainRange(fixed);
47 }
48 });
49 popupMenu.insert(fixedDomainCheckBox, 0);
50 popupMenu.insert(new JPopupMenu.Separator(), 1);
51 }
52
53 @Override
54 public AbstractSpaceTimePlot getPlot()
55 {
56 return (AbstractSpaceTimePlot) super.getPlot();
57 }
58
59 }