第1个类:
abstract class Joueur implements Attaque{
protected Case position;
protected Echiquier E;
public final boolean isBlue; protected int vitalite;
protected float precision; // En pourcentage
protected int force; public Joueur(Echiquier E, Case c, boolean isBlue) {
this.E = E;
position = c;
this.isBlue = isBlue;
}
protected boolean moveOk(Case c) {
return (E.getTour() == isBlue) && (c.J == null);
//如果顺序轮转到 并且目标格无棋子 可前进
//不同的棋子的行动方式会在子类中具体实现
}
        protected boolean attaqueOk(Case c) {
return (E.getTour() == isBlue) && (c.J.isBlue!=isBlue);
//如果顺序轮转到 并且目标格是对方棋子棋子 可攻击
//不同的棋子的攻击方式会在子类中具体实现
}
第2个类:
class Case extends JPanel implements MouseListener{ 
 private final Color couleur;
 private boolean click;
 private static boolean clicked=false;
 public Joueur J;
 public final int x,y;
 public static Case destination=null;
 
 Case(Color c, int x, int y, Joueur J){
  setBackground(c);
setPreferredSize(new Dimension(50,50)); 
setSize(getPreferredSize());
addMouseListener(this);

couleur=c;
click=false;
this.x=x;
this.y=y;
this.J=J;
 } public void ResetColor(){
setBackground(couleur);
 } public void mousePressed(MouseEvent e){
click=true; 
clicked=true; 
setBackground(Color.yellow); 
destination=this; 
 }
 
 public void mouseEntered(MouseEvent e) { if (clicked)
destination = this; 
if (!click && clicked && this.J.moveOk(destination))
setBackground(Color.green); 
                if (!click && clicked && this.J.attaqueOk(destination))
setBackground(Color.red);
} public void mouseReleased(MouseEvent e) {
ResetColor();

click=false;
clicked=false;

if(destination != null){     destination.ResetColor();

     J.moveTo(destination);
}
 }大致意思是当棋盘中鼠标点击棋子后移动鼠标到任何一个格
如果目标格是可到达的 则在棋盘中显示绿色 如果目标格有对方棋子可攻击 显示红色程序运行的时候中断显示:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at Case.mouseEntered(Case.java:71)
请问这个怎么调用可以解决这个问题?