2):监听键盘按下 3):监听键盘抬起*/public class Tank { private static final int SPEED = 5; // 坦克的速度 private int x, y; //坦克的初始位置 private Direction direction; // 坦克的方向 public Tank(int x, int y, Direction direction){ this.x = x; this.y = y; this.direction = direction; } // 1):得到窗口传递的画笔,绘制自己 public void paint (Graphics g) { g.drawImage(ImagesResource.goodTankD, x, y, null); } // 2):监听键盘按下 public void keyPressed(KeyEvent e) { } // 3):监听键盘抬起 public void keyReleased(KeyEvent e) { }}