package nl.tudelft.simulation.examples.dsol.animation3d; 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.experiment.Replication; import nl.tudelft.simulation.dsol.experiment.ReplicationMode; import nl.tudelft.simulation.dsol.simtime.SimTimeDouble; import nl.tudelft.simulation.dsol.simulators.DESSSimulator; import nl.tudelft.simulation.dsol.simulators.DESSSimulatorInterface; import nl.tudelft.simulation.dsol.swing.animation.D2.AnimationPanel; import nl.tudelft.simulation.dsol.swing.gui.DSOLApplication; import nl.tudelft.simulation.dsol.swing.gui.DSOLPanel; import nl.tudelft.simulation.language.DSOLException; /** *

* Copyright (c) 2002-2020 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 Ball3DSwingApplication extends DSOLApplication { /** * @param title String; the title * @param panel DSOLPanel<Double,Double,SimTimeDouble>; the panel */ public Ball3DSwingApplication(final String title, final DSOLPanel panel) { super(title, panel); } /** */ private static final long serialVersionUID = 1L; /** * @param args String[]; arguments, expected to be empty * @throws SimRuntimeException on error * @throws RemoteException on error * @throws NamingException on error * @throws DSOLException when simulator does not implement AnimatorInterface */ public static void main(final String[] args) throws SimRuntimeException, RemoteException, NamingException, DSOLException { // TODO: Make 3D examples work with Java-8 and provide good instructions DESSSimulator.TimeDouble simulator = new DESSSimulator.TimeDouble("Ball3DSwingApplication", 0.01); BallModel3D model = new BallModel3D(simulator); Replication.TimeDouble replication = Replication.TimeDouble.create("rep1", 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 Ball3DSwingApplication("Ball 3D Animation model", panel); } }