We describe in this chapter how to create an interactive simulation in Java using Easy Java Simulations (Ejs for short). In order to get a general perspective of the complete process, we will inspect, run and finally modify, slightly but meaningfully, an already existing simulation. This will help us identify the parts that make a simulation, as well as become acquainted with our authoring tool. | Easy Java Simulations The Manual Version - September 2005 Francisco Esquembre Contents 1 A first contact 1 About Easy Java Simulations . . . . . . . . . . . . . . . . . . . . . . 1 Installing and running Ejs . . . . . . . . . . . . . . . . . . . . . . . . 2 Working with a simulation . . . . . . . . . . . . . . . . . . . . . . . . 10 Inspecting the simulation . . . . . . . . . . . . . . . . . . . . . . . . 15 Modifying the simulation . . . . . . . . . . . . . . . . . . . . . . . . 23 A global vision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 2 Creating models 39 Definition of a model . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 Interface for the model in Easy Java Simulations . . . . . . . . . . . 43 Declaration of variables . . . . . . . . . . . . . . . . . . . . . . . . . 45 Initializing the model . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 Evolution equations . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 Constraint equations . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 Custom methods and additional libraries . . . . . . . . . . . . . . . . 65 iii iv chapter 3 Building a view 77 Graphical interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 Association between variables and properties . . . . . . . . . . . . . 81 How a simulation runs . . . . . . . . . . . . . . . . . . . . . . . . . . 82 Interface of Easy Java Simulations for the view . . . . . . . . . . . . 83 Editing properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 Learning more about view elements . . . . . . . . . . . . . . . . . . . 94 4 Using the simulation 103 Using your simulations . . . . . . . . . . . . . . . . . . . . . . . . . . 103 Files generated for a simulation . . . . . . . . . . . . . . . . . . . . . 105 Ejs configuration .