Class SwingPlot

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants
Direct Known Subclasses:
SwingFundamentalDiagram, SwingSpaceTimePlot

public class SwingPlot extends JFrame
Swing wrapper of all plots. This schedules regular updates, creates menus and deals with listeners. There are a number of delegate methods for sub classes to implement.

Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.

Author:
Alexander Verbraeck, Peter Knoppers, Wouter Schakel
See Also:
  • Field Details

    • plot

      protected final org.opentrafficsim.draw.graphs.AbstractPlot plot
      The JFreeChart plot.
  • Constructor Details

    • SwingPlot

      public SwingPlot(org.opentrafficsim.draw.graphs.AbstractPlot plot)
      Construct a new Swing container for an AbstractPlot.
      Parameters:
      plot - AbstractPlot; the plot to embed
  • Method Details

    • setChart

      protected void setChart(org.jfree.chart.JFreeChart chart)
      Add the chart.
      Parameters:
      chart - JFreeChart; the chart
    • setStatusLabel

      protected final void setStatusLabel(String label)
      Manually set status label from sub class. Will be overwritten by a moving mouse pointer over the axes.
      Parameters:
      label - String; label to set
    • addPopUpMenuItems

      protected void addPopUpMenuItems(JPopupMenu popupMenu)
      Overridable method to add pop up items.
      Parameters:
      popupMenu - JPopupMenu; pop up menu
    • getChartMouseListener

      protected org.jfree.chart.ChartMouseListener getChartMouseListener()
      Overridable; may return a chart listener for additional functions.
      Returns:
      ChartMouseListener, null by default
    • getPlot

      public org.opentrafficsim.draw.graphs.AbstractPlot getPlot()
      Retrieve the plot.
      Returns:
      AbstractPlot; the plot