public void update(Graphics g) {
// TODO Auto-generated method stub
if(offScreenImage == null){
offScreenImage = this.createImage(GAME_WIDTH,GAME_HEIGHT);
}
Graphics goffScreen = offScreenImage.getGraphics();
goffScreen.fillRect(0, 0, GAME_WIDTH,GAME_HEIGHT);
Color c = goffScreen.getColor();
goffScreen.setColor(Color.PINK);
goffScreen.setColor(c);
paint(goffScreen);
g.drawImage(offScreenImage, 0, 0, null);
super.update(g);
}
public void lauchFram(){
this.setLocation(400, 300);
this.setSize(GAME_WIDTH,GAME_HEIGHT);
this.setTitle("TankWar");
this.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
// TODO Auto-generated method stub
super.windowClosing(e);
System.exit(0);
}
});
this.setResizable(false);
this.setBackground(Color.PINK);