import java.awt.* ;
import javax.swing.* ;
import java.awt.event.*;
import java.util.EventListener;
class f extends JFrame {
f(String title) {
this.setTitle(title) ;
this.setSize(608 , 630) ;
this.setLocation(300 , 100) ;
this.setBackground(Color.BLACK) ;
MyTank mp = new MyTank() ;
this.add(mp) ;
this.addKeyListener(mp) ;
new Thread(mp).start() ;
}
public static void main(String[] args) {
f h = new f("坦克大战(版本1.0)") ;
h.setVisible(true) ;
}
}
//主战坦克
class MyTank extends JPanel implements KeyListener , Runnable {
int x = 280, y = 280 ;//坦克的初始位置
int op = 1 ;//坦克的移动方向
int color = 0 ;
int tankspeed = 8 ;//坦克的速度
int tankbullet = 8 ;//坦克的子弹速度
int ta