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

📄 rectmover.java

📁 书籍"Java_面向事件编程"的附带光盘代码
💻 JAVA
字号:
import objectdraw.*;// class to animate the vertical motion of members of a// collection of FilledRectspublic class RectMover extends ActiveObject {        // the delay between moves    private final double DELAY = 400;        // the collection whose rects should be moved    private RectCollection theRects;        // how far to move in one step    private double dropSize;        // create an ActiveObject to slowly move all the rectangles    // in a collection up or down on the screen    public RectMover (RectCollection rects, double dy) {        dropSize = dy;        theRects = rects;        start();    }        public void run() {                while (true){                        theRects.goToFirst();            while ( theRects.rectsLeft() ){                theRects.getNextRect().move(0,dropSize);                pause( DELAY);            }                    }    }}

⌨️ 快捷键说明

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