我们认定,一个优秀的解决方案应该有一个新的称为RolloverImageIcon的类,我们将在其构造函数中给它提供一张图像,然后,这个类会在绘制图标之前对图标进行操作。
We decided that a good solution would be to have a new class called RolloverImageIcon that was given an image in its constructor and would then manipulate the icon before drawing it.
创建要在其中绘制图标的矩形。
矩形的位置确定图标在屏幕上的位置,矩形的大小确定绘制图标的缩放。
The position of the rectangle locates the icon on the screen, and the size of the rectangle determines the scaling of the drawn icon.
应用推荐