risingsun.java
来自「书籍"Java_面向事件编程"的附带光盘代码」· Java 代码 · 共 23 行
JAVA
23 行
import objectdraw.*;import java.awt.*;// A program that produces an animation of the sun rising.// The animation is driven by clicking the mouse button.// The faster the mouse is clicked, the faster the sun will rise.public class RisingSun extends WindowController{ private FilledOval sun; // Circle that represents the sun // Place the sun and some brief instructions on the screen public void begin() { sun = new FilledOval( 50, 150, 100, 100, canvas); new Text( "Please click the mouse repeatedly", 20, 20, canvas); } // Move the sun up a bit each time the mouse is clicked public void onMouseClick(Location point) { sun.move(0, -5); } }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?