Class OTSSwingApplication<T extends OTSModelInterface>

Type Parameters:
T - model type
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants
Direct Known Subclasses:
OTSSimulationApplication

public class OTSSwingApplication<T extends OTSModelInterface>
extends JFrame
Wrap a DSOL simulation model, or any (descendant of a) JPanel in a JFrame (wrap it in a window). The window will be maximized.

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

$LastChangedDate: 2018-09-19 13:55:45 +0200 (Wed, 19 Sep 2018) $, @version $Revision: 4006 $, by $Author: averbraeck $, initial version 16 dec. 2014

Author:
Alexander Verbraeck, Peter Knoppers
See Also:
Serialized Form
  • Field Details

    • DEFAULT_COLORER

      public static final GTUColorer DEFAULT_COLORER
      Single instance of default colorer, reachable from various places.
    • closed

      protected boolean closed
      whether the application has been closed or not.
    • frameProperties

      protected Properties frameProperties
      Properties for the frame appearance (not simulation related).
  • Constructor Details

    • OTSSwingApplication

      public OTSSwingApplication​(T model, JPanel panel)
      Wrap an OTSModel in a JFrame. Uses a default GTU colorer.
      Parameters:
      model - T; the model that will be shown in the JFrame
      panel - JPanel; this should be the JPanel of the simulation
  • Method Details

    • setAppearance

      public void setAppearance​(Appearance appearance)
      Sets an appearance.
      Parameters:
      appearance - Appearance; appearance
    • getAppearance

      public Appearance getAppearance()
      Returns the appearance.
      Returns:
      Appearance; appearance
    • makeAnimationRectangle

      protected Rectangle2D makeAnimationRectangle()
      Return the initial 'home' extent for the animation. The 'Home' button returns to this extent. Override this method when a smaller or larger part of the infra should be shown. In the default setting, all currently visible objects are shown.
      Returns:
      the initial and 'home' rectangle for the animation.
    • setExitOnClose

      public final void setExitOnClose​(boolean exitOnClose)
      Parameters:
      exitOnClose - boolean; set exitOnClose
    • isClosed

      public final boolean isClosed()
      Returns:
      closed
    • getModel

      public final T getModel()
      Returns:
      model