想请大家看一下错在哪里呀,下面的是eclipse的错误提示
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;
public void init(){
score=20;
for (int i = 0; i < ballcount; i++) {
x = (int) (Math.random() * 800);
y = (int) (Math.random() * 600);
ch=(char)(Math.random()*26+65);
ballColor=new Color((int)(Math.random()*255),(int)(Math.random()*255),(int)(Math.random()*255));
}
//少了一个后花括号
}
楼上解析的对 1楼 楼上回复正确 1楼正解{:4_96:}
页:
[1]