📄 wall.java
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -