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

📄 randomlybouncingballs.java

📁 书籍"Java_面向事件编程"的附带光盘代码
💻 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 + -