wall.java
来自「一些JAVA的小程序」· Java 代码 · 共 37 行
JAVA
37 行
import java.awt.*;public class Wall implements PinBallTarget{ public Rectangle location; public Wall (int x, int y, int width, int height) { location = new Rectangle(x, y, width, height); } public void moveTo (int x, int y) { location.setLocation(x, y); } public void paint (Graphics g) { g.setColor(Color.black); g.fillRect(location.x, location.y, location.width, location.height); } public boolean intersects (PinBall aBall) { return location.intersects(aBall.box()); } public void hitBy (PinBall aBall) { if ((aBall.y() < location.y) || (aBall.y() > (location.y + location.height))) aBall.reflectHorz(); else aBall.reflectVert(); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?