这是一个未完成的俄罗斯方块程序
不知为什么不能运行,红字处的总是报错,不知道为什么呀???
说是无法从静态上下文中引用非静态变量this...不知道为什么呀,,请大虾们指教!谢谢了package elsfkgame;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.Random;
import java.util.Iterator;
import java.util.ArrayList;
import java.awt.geom.*;
/**
 *
 * @author Administrator
 */
public class elsfkGame{
    
    
   
     public static void main(String[] args) {
        // TODO code application logic here
         
        youxiquanjuJFrame frame=new youxiquanjuJFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setVisible(true);
       
    }
     
   class threadRunnable implements Runnable{
   
    GaojiJPanel gaojiJPanel=new GaojiJPanel();
   public threadRunnable (fangkuaimove afangkuaimove ,Component aComponent){
   fangkuaimove=afangkuaimove;
   component=aComponent;
   } 
       
   public void run(){
   try{
   for(int a2=0;a2<=15;a2++){
   fangkuaimove.move();
   
   component.repaint();
   Thread.sleep(50);
   }
   }
   
   catch(InterruptedException e)
   {
   }
   }
   private Component component;
   private fangkuaimove fangkuaimove;
   }
     
    class GaojiJPanel extends JPanel {
    
  public ArrayList huafangkuai=new ArrayList();
  public ArrayList huafangkuai2=new ArrayList();
     
  public ArrayList huituArrayList=new ArrayList();
  public boolean[][] fangkuai=new boolean[15][15];
 
   
     public void paintComponent(Graphics g){
     super.paintComponent(g);
     Iterator huafangkuaiIterator=huafangkuai.iterator();
     Iterator huafangkuaiIterator2=huafangkuai2.iterator();
     huiTu huatu,huatu2;
     while(huafangkuaiIterator.hasNext()){
         huatu=(huiTu)huafangkuaiIterator.next();
         huatu.draw(g);
         
     }
     huafangkuai.clear();
     while(huafangkuaiIterator2.hasNext()){
     huatu2=(huiTu)huafangkuaiIterator2.next();
     huatu2.draw(g);
     }
     huafangkuai2.clear();
     
     }
      
     }
    
    class fangkuaimove {
    GaojiJPanel gaojiJPanel2=new GaojiJPanel();
    public void move()
    { 
        for (int a2=0;a2<=15;a2++){
           for(int b2=0;b2<=15;b2++){
              if(gaojiJPanel2.fangkuai[a2][b2]==true){
                  gaojiJPanel2.fangkuai[a2][b2]=false;
                  gaojiJPanel2.fangkuai[a2][b2+1]=true;
              
              }
                      
           }
        }
        
    
    
    for(int a=0;a<=15;a++){
      for(int b=0;b<=15;b++){
        if(gaojiJPanel2.fangkuai[a][b]==true){
        huiTu fangkuai1=new huiTu(a*3,b*3,2,2,Color.YELLOW);
        gaojiJPanel.huafangkuai.add(fangkuai1);
       
        }
        else
        {
        huiTu fangkuai2=new huiTu(a*3,b*3,2,2,Color.BLACK);
        gaojiJPanel.huafangkuai2.add(fangkuai2);
        }
        
      }
    
    
    }
     
    }
    
}
    /**
     * @param args the command line arguments
     */
    class huiTu extends Rectangle{    private Color fillColor;
    
    public huiTu(int xValue,int yValue,int widthValue,int heightValue,Color colorValue){
    super(xValue,yValue,widthValue,heightValue);
    setFillColor(colorValue);
    }
    public void setFillColor(Color colorValue){
    fillColor=colorValue;
    }
    public Color getFillColor(){
    return fillColor;
    }
    public void draw(Graphics g){
    g.setColor(fillColor);
    g.fillRect(x,y,width,height);
    
    }
}
 class youxiquanjuJFrame extends JFrame{
    
    public youxiquanjuJFrame(){
        
    setTitle("俄罗斯方块");
    setSize(WIDTH,HEIGHT);
    
    
    
    gaojiJPanel=new GaojiJPanel();
    add(gaojiJPanel);
    JPanel buttonPanel=new JPanel();
    addButton(buttonPanel,"START",
            new ActionListener(){
    public void actionPerformed(ActionEvent event){
   startJButtonActionPerformed(event);
    }
    }
            );
            
    addButton(buttonPanel,"LEFT",
            new ActionListener()
    {
    public void actionPerformed(ActionEvent event){
    leftJButtonActionPerformed(event);
    }
    }
            )        ;
            
    addButton(buttonPanel,"RIGHT",
            new ActionListener()
    {
    public void actionPerformed(ActionEvent event){
    rightJButtonActionPerformed(event);
    }
    }
            );
            
    addButton(buttonPanel,"STOP",
            new ActionListener()
    {
     public void actionPerformed(ActionEvent event){
    stopJButtonActionPerformed(event);
    }
    
    }
            );
            
     addButton(buttonPanel,"TURN",
             new ActionListener()
     {
     public void actionPerformed(ActionEvent event){
     turnJButtonActionPerformed(event);
     }
     });
   
    }
    public void addButton(Container c,String title,ActionListener listener){
    JButton button=new JButton(title);
    c.add(button);
    button.addActionListener(listener);
    }
    
    public void startJButtonActionPerformed(ActionEvent event){
      
       gaojiJPanel.fangkuai[0][10]=true; 
       gaojiJPanel.fangkuai[0][11]=true;
       gaojiJPanel.fangkuai[0][12]=true;
       gaojiJPanel.fangkuai[0][13]=true;
       fangkuaimove b=new fangkuaimove();
       Runnable r=new threadRunnable(b,gaojiJPanel);
       Thread t=new Thread(r);
       t.start();
        
       
    }
    
   
    public void  stopJButtonActionPerformed(ActionEvent event){
    
     
        
    }
    public void leftJButtonActionPerformed(ActionEvent event){
    
    GaojiJPanel gaojiJPanel2=new GaojiJPanel();
   
        for (int a2=0;a2<=15;a2++){
           for(int b2=0;b2<=15;b2++){
              if(gaojiJPanel2.fangkuai[a2][b2]==true){
                  gaojiJPanel2.fangkuai[a2][b2]=false;
                  gaojiJPanel2.fangkuai[a2-1][b2]=true;
              
              }
                      
           }
        }
        
    
    
    for(int a=0;a<=15;a++){
      for(int b=0;b<=15;b++){
        if(gaojiJPanel2.fangkuai[a][b]==true){
        huiTu fangkuai1=new huiTu(a*3,b*3,2,2,Color.YELLOW);
        gaojiJPanel.huafangkuai.add(fangkuai1);
       
        }
        else
        {
        huiTu fangkuai2=new huiTu(a*3,b*3,2,2,Color.BLACK);
        gaojiJPanel.huafangkuai2.add(fangkuai2);
        }
        
      
    
    
    
     
    }
    
}
    }
    public void turnJButtonActionPerformed(ActionEvent event){
    
    }
    public void rightJButtonActionPerformed(ActionEvent event){
    
    }
 }
 public JButton leftJButton;
    public JButton rightJButton;
    public JButton turnJButton;
    public JButton stopJButton;
    public JButton startJButton;
    public GaojiJPanel gaojiJPanel;
    public static final int WIDTH=450;
    public static final int HEIGHT=250;
}