コード例 #1
0
 /**
  * Enables the steps per display variable in the control;
  *
  * @param enable boolean
  */
 public void enableStepsPerDisplay(boolean enable) {
   showStepsPerDisplay = enable;
   if (showStepsPerDisplay) {
     control.setAdjustableValue("steps per display", stepsPerDisplay);
   } else {
     control.removeParameter("steps per display");
   }
 }
コード例 #2
0
 /**
  * Invokes the simulation's start method and then starts the animation thread. Simulations should
  * not override this method. Override the start method to perform custom actions just before a
  * thread starts.
  *
  * @deprecated
  */
 public void startAnimation() {
   if (showStepsPerDisplay) {
     stepsPerDisplay = control.getInt("steps per display");
   }
   start();
   startRunning();
   super.startAnimation();
 }
コード例 #3
0
 /**
  * Steps the simulation.
  *
  * <p>This method is final in order to insure that all AbsractSimulations invoke startRunning(),
  * doStep(), stepCounter++ and stopRunning() in the correct order.
  */
 public final void stepAnimation() {
   if (showStepsPerDisplay) {
     stepsPerDisplay = control.getInt("steps per display");
   }
   startRunning();
   super.stepAnimation();
   stepCounter++;
   stopRunning();
   org.opensourcephysics.display.GUIUtils.repaintAnimatedFrames();
 }
コード例 #4
0
 /**
  * Resets the animation to its default condition. Simulations should invoke the reset method.
  *
  * @deprecated
  */
 public void resetAnimation() {
   if (control == null) {
     return; // control can be null in applet mode so check for this
   }
   super.resetAnimation();
   stepsPerDisplay = 1;
   if (showStepsPerDisplay) {
     control.setAdjustableValue("steps per display", stepsPerDisplay);
   }
   reset();
 }
コード例 #5
0
 /**
  * Sets the number of animation steps before animated drawing panels are rendered.
  *
  * <p>The default steps per animation is 1. Increase this number if frequent rendering causes
  * slugish behavior.
  *
  * @param num int
  */
 public void setStepsPerDisplay(int num) {
   stepsPerDisplay = Math.max(num, 1);
   if (showStepsPerDisplay) {
     control.setAdjustableValue("steps per display", stepsPerDisplay);
   }
 }