请高手帮我看看
import java.awt.*;import javax.swing.*;
class Link extends JFrame{
public static final int ROW=6;
public static final int COL=7;
private JPanel p1=new JPanel();
private JPanel p2=new JPanel();
private JButton[][] button=new JButton[ROW][COL];
public Link(){
this.setSize(600,500);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setLayout(new BorderLayout());
p1.setBackground(Color.BLUE);
p1.setLayout(new GridLayout());
p1.setPreferredSize(new Dimension(500,500));
for(int i=0;i<ROW;i++){
for(int j=0;j<COL;j++){
button[i][j]=new JButton();
p1.add(button[i][j]);
}
}
p2.setBackground(Color.YELLOW);
p2.setPreferredSize(new Dimension(100,500));
this.add(p1,BorderLayout.CENTER);
this.add(p2,BorderLayout.EAST);
this.setVisible(true);
}
}
运行时老是提行:Exception in thread "main" java.lang.NullPointerException