📄 cannontarget.java
字号:
import java.awt.*;public class CannonTarget { public CannonTarget(Point loc) { location = loc; } private Point location; private static final int width = 50; public boolean hitTarget(double x){ //see if target has been hit return(x > location.x) && (x-20 < location.x + width); } public void paint(Graphics g) { g.setColor(Color.red); g.fillRoundRect(location.x, location.y, width, 10, 6, 6); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -