我会知道我的实现对于双缓冲图像是否正确..因为我注意到我在屏幕中移动的图像的边框会颤抖......这很正常吗?
public void paintComponent(Graphics g) {
Image bufferimage= createImage(180,180);
Graphics dbg= bufferimage.getGraphics();
//clean the screen
dbg.setColor(new Color(100,100,100));
dbg.fillRect(0,0,getWidth(),getHeight());
if (game_is_running) {
// draw various type of object with drawImage
for(int i=0; list[i]!=null; i++) {
list[i].draw(dbg);
}
target.draw(dbg);
I.draw(dbg);
}
//finally draw the image linked to graphics
g.drawImage(bufferimage,0,0,this);
}