package nl.tudelft.simulation.examples.dsol.animation; import java.awt.Dimension; import java.awt.geom.Rectangle2D; import java.rmi.RemoteException; import javax.naming.NamingException; import nl.tudelft.simulation.dsol.SimRuntimeException; import nl.tudelft.simulation.dsol.animation.D2.AnimationPanel; import nl.tudelft.simulation.dsol.experiment.Replication; import nl.tudelft.simulation.dsol.experiment.ReplicationMode; import nl.tudelft.simulation.dsol.gui.swing.DSOLApplication; import nl.tudelft.simulation.dsol.gui.swing.DSOLPanel; import nl.tudelft.simulation.dsol.simtime.SimTimeDouble; import nl.tudelft.simulation.dsol.simulators.DEVSRealTimeClock; /** *

* Copyright (c) 2002-2018 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights * reserved. See for project information * https://simulation.tudelft.nl. The DSOL project is distributed under a three-clause BSD-style license, which can * be found at * https://simulation.tudelft.nl/dsol/3.0/license.html. *

* @author Alexander Verbraeck */ public class BallSwingApplication extends DSOLApplication { /** * @param title the title * @param panel the panel */ public BallSwingApplication(final String title, final DSOLPanel panel) { super(title, panel); } /** */ private static final long serialVersionUID = 1L; /** * @param args arguments, expected to be empty * @throws SimRuntimeException on error * @throws RemoteException on error * @throws NamingException on error */ public static void main(final String[] args) throws SimRuntimeException, RemoteException, NamingException { BallModel model = new BallModel(); DEVSRealTimeClock.TimeDouble simulator = new DEVSRealTimeClock.TimeDouble(0.01); Replication replication = new Replication<>("rep1", new SimTimeDouble(0.0), 0.0, 1000000.0, model); DSOLPanel panel = new DSOLPanel<>(model, simulator); panel.getTabbedPane().add("animation", new AnimationPanel(new Rectangle2D.Double(-100, -100, 200, 200), new Dimension(200, 200), simulator)); panel.getTabbedPane().setSelectedIndex(1); simulator.initialize(replication, ReplicationMode.TERMINATING); new BallSwingApplication("MM1 Queue model", panel); } }