代码下面放,百度说是重画的问题。可是移动窗口也不能显示
public class TankClient extends Frame{ public static int WEIDTH=800;
public static int HEIGHT=600;
 
public List<Wall> walls=new ArrayList<Wall>();
         Graphics g=null;
         Image offScreenImage = null;

    class MouseMonitor extends MouseAdapter {
     public void mouseClicked(MouseEvent e) {
         System.out.println("主页面的鼠标单击");
     Point p=e.getPoint();
     walls.add(new  Wall(p.x,p.y,Wall.wallStyle.stone,null));
    
     }
    }
    
public void lanchFrame(){

this.setSize(WEIDTH, HEIGHT);
this.setLocation(200, 50);
setTitle("坦克大战");
this.setBackground(Color.GREEN);

this.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
new Thread(new PaintThread()).start();
this.addMouseListener(new  MouseMonitor());

       
this.setVisible(true); this.setResizable(false);
    }

public void paint(Graphics g) {
System.out.println("重画!");
for(int i=0; i<walls.size(); i++) {
Wall w = walls.get(i);
w.draw(g);
}
}


public void update(Graphics g) {
if(offScreenImage == null) {
offScreenImage = this.createImage(WIDTH, HEIGHT);
}
Graphics gOffScreen = offScreenImage.getGraphics();
Color c = gOffScreen.getColor();
gOffScreen.setColor(Color.BLACK);
gOffScreen.fillRect(0, 0, WIDTH,HEIGHT);
gOffScreen.setColor(c);
paint(gOffScreen);
g.drawImage(offScreenImage, 0, 0, null);
}

private class PaintThread implements Runnable { public void run() {
while(true) {
    repaint();
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}

public static void main(String[] args){
new TankClient().lanchFrame();
}
}wall类的draw()public void draw(Graphics g){
System.out.println("draw");

if(!this.live){
tc.walls.remove(this);
return ;
}

if(!init){
System.out.println("initwall");
init=true;
for(int i=0;i<wallImage.length;i++){
System.out.println("drawImage"+i);
g.drawImage(wallImage[i], -100, -100, null);
}
}

if(style==wallStyle.grass){
// System.out.println("drawgrass"+locationX+locationY);
// g.drawImage(wallImage[0], locationX, locationY, null);
Color c = g.getColor();
g.setColor(Color.DARK_GRAY);
g.fillRect(locationX,locationY,50,50);
g.setColor(c);
}
else if(style==wallStyle.stone){
// System.out.println("drawstone"+locationX+locationY);
// g.drawImage(wallImage[1], locationX, locationY, null);
Color c = g.getColor();
g.setColor(Color.DARK_GRAY);
g.fillRect(locationX,locationY,50,50);
g.setColor(c);
}
}