import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.*;
public class MyGame extends JFrame {
public MyGame(){
this.setTitle("我的游戏");
this.setBounds(300,100, 800, 600);
this.setVisible(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setBackground(Color.black);
MyPanel mp=new MyPanel();
add(mp);
this.addKeyListener(mp) ;
mp.addKeyListener(mp);
Thread t=new Thread();
t.start();
}
public static void main(String args[]){
new MyGame();
}
}
class MyPanel extends JPanel implements Runnable,KeyListener{
int score;