public BottomBar(Canvas sim) { this.sim = sim; setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); Slydr[] slydrs = new Slydr[] { t = new Slydr("Time step", 1, Params.timestep, Params.timestep), g = new Slydr("Gravity", 0, 10, Params.gravity), m = new Slydr("Magnetism", 1, 20000, Params.magnetism), d = new Slydr("Delay", 1, 1000, Params.delay), }; for (Slydr slydr : slydrs) { add(slydr); slydr.setChangeListener(new Updater()); } }
private void updateConstants() { sim.setTimeStep(t.getValue()); sim.setGravity(g.getValue()); sim.setMagnetism(m.getValue()); sim.setDelay(d.getValue()); }