📄 randomlybouncingballs.java
字号:
import java.awt.*;import objectdraw.*;// A class to draw a bunch of basketballs on the screen so// that by clicking we can watch them bounce randomlypublic class RandomlyBouncingBalls extends WindowController{ // all the balls displayed. private BallCollection allTheBalls; // create the balls as soon as the program starts public void begin() { allTheBalls = new BallCollection( canvas ); } // create an active object to bounce them when clicked. public void onMouseClick( Location point ) { new Bouncer( allTheBalls ); } // hide all the balls when the mouse leaves public void onMouseExit( Location point ) { allTheBalls.hide(); } // show all the balls when the mouse arrives public void onMouseEnter( Location point ) { allTheBalls.show(); } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -