📄 rectmover.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 + -