⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 animateobject.java

📁 利用BlueJ开发的一个类似小时候完的吃豆豆的小游戏
💻 JAVA
字号:
/* * $Id: AnimateObject.java,v 1.1.1.1 2002/06/05 21:56:32 root Exp $ * * Developed for "Rethinking CS101", a project of Lynn Andrea Stein's AP Group. * For more information, see <a href="http://www.ai.mit.edu/projects/cs101/">the * CS101 homepage</a> or email <las@ai.mit.edu>. * * Copyright (C) 1999 Massachusetts Institute of Technology. * Please do not redistribute without obtaining permission. */package cs101.util;import cs101.lang.*;/** * The generic self-animating (active) object.  Extend it, overriding * its act() method, to generate interesting behavior. * * Copyright 1999 Massachusetts Institute of Technology * * @see cs101.lang.AnimatorThread * @see cs101.lang.Animate * * @author Lynn Andrea Stein, las@ai.mit.edu * @version $Id: AnimateObject.java,v 1.1.1.1 2002/06/05 21:56:32 root Exp $ * */public abstract class AnimateObject extends Object implements Animate {  /* CONSTANTS */    /**   * These constants allow mnemonic access to AnimateObject's final   * constructor argument, i.e., should the object start running on   * construction or on (a subsequent) call to a separate start()   * method?   *   * @see #AnimateObject( boolean )    */  public static boolean START_IMMEDIATELY = true,                        DONT_START_YET = false;  /* FIELDS */  /**   * The animacy that makes this object go.   *   * @see cs101.lang.AnimatorThread   */  protected AnimatorThread spirit;    /* CONSTRUCTORS */  /**   * The most basic constructor creates the AnimateObject and starts   * its animacy going.    */  public AnimateObject()   {    this( AnimateObject.START_IMMEDIATELY );  }    /**   * This constructor allows you to create an AnimateObject without   * starting its animacy going. (You do this by calling this   * constructor with <tt>AnimateObject.DONT_START_YET</tt>, i.e., the   * boolean <tt>false</tt>. If you do this, the animacy will not   * actually begin execution until you call this AnimateObject's   * start() method.   *   * @param startImmediately   If false, execution does not start until   *          explicit invocation of this object's start() method.   *   * @see #START_IMMEDIATELY   * @see #DONT_START_YET   */  public AnimateObject( boolean startImmediately )   {    super();        this.spirit = new AnimatorThread(this);    if ( startImmediately )      {	this.spirit.startExecution();      }  }    /**   * Invocation of this method begins this object's autonomous execution.     *   * (If execution has already begun, this method does nothing.)   *   * @see #AnimateObject( boolean )   */  public void start() {    this.spirit.start();  }  /**   * Override this method to give the AnimateObject behavior.   *   * The default behavior -- Thread.yield() -- simply gives other    * animacies a chance to run.   */  public abstract void act();  }/* Comments: * * History: * $Log: AnimateObject.java,v $ * Revision 1.1.1.1  2002/06/05 21:56:32  root * CS101 comes to Olin finally. * * Revision 1.4  1999/06/18 21:37:47  las * Updated AnimateObject to work with the new AnimatorThread/Animate * paradigm.  AnimateObject is now an abstract class; its act() method * must be overridden to create a useful object. * * Revision 1.3 1998/07/24 17:19:21 tparnell * Placate new javadoc behavior * * Revision 1.2 1998/06/24 20:58:36 tparnell * formatting fixed * * Revision 1.1 1998/06/08 18:11:52 tparnell * added files from Lynn * */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -