Package coconad

Class TrainView

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Runnable, Accessible, RootPaneContainer, WindowConstants

public class TrainView extends JFrame implements Runnable
Class for a train viewer frame.
Since:
2013.11.29
See Also:
  • Field Details

    • VERSION

      public static final String VERSION
      the version string
      See Also:
    • PROGRAM

      public static final int PROGRAM
      mode flag: the scatter plot is a stand-alone program
      See Also:
    • LOAD_ITEMS

      public static final int LOAD_ITEMS
      mode flag: add menu items for loading trains
      See Also:
  • Constructor Details

    • TrainView

      public TrainView(int mode)
      Create a train view frame.
      Parameters:
      mode - the mode flags
      Since:
      2013.11.29 (Christian Borgelt)
    • TrainView

      public TrainView(Component owner, int mode)
      Create a train view frame.
      Parameters:
      owner - the component that is to own this bar chart
      mode - the mode flags
      Since:
      2013.11.29 (Christian Borgelt)
  • Method Details

    • run

      public void run()
      Create the user interface.

      Following the recommendations in the Java tutorial, the user interface is created in the "run" method, which is invoked from the event queue, in order to avoid problems with threads.

      Specified by:
      run in interface Runnable
      Since:
      2013.11.29 (Christian Borgelt)
    • setColor

      public void setColor(Color c)
      Set the color of the bars.
      Parameters:
      c - the color of the bars
      Since:
      2013.11.29 (Christian Borgelt)
    • setTrains

      public void setTrains(TrainSet trains)
      Set the train set to display.
      Parameters:
      trains - the train set to display
      Since:
      2013.11.29 (Christian Borgelt)
    • getTrains

      public TrainSet getTrains()
      Get the current train set to display.
      Returns:
      the current train set to display
      Since:
      2013.11.29 (Christian Borgelt)
    • setRange

      public void setRange(double beg, double end)
      Set the range of event/spike times to display.
      Parameters:
      beg - the beginning of the time range to display
      end - the end of the time range to display
      Since:
      2013.11.30 (Christian Borgelt)
    • reportError

      public void reportError(String msg)
      Report an I/O error.
      Parameters:
      msg - the error message to report
      Since:
      2013.11.29 (Christian Borgelt)
    • loadTrains

      public boolean loadTrains(File file)
      Load the train set to display.
      Parameters:
      file - the file to load the trains from
      Returns:
      whether the file was successfully loaded
      Since:
      2013.11.29 (Christian Borgelt)
    • saveImage

      public boolean saveImage(File file)
      Save a PNG image of the panel.
      Parameters:
      file - the file to save the image to
      Returns:
      whether the file was successfully written
      Since:
      2013.11.29 (Christian Borgelt)
    • main

      public static void main(String[] args)
      Main function for command line invocation.
      Parameters:
      args - the command line arguments
      Since:
      2013.11.29 (Christian Borgelt)