How to get rid of the flicker that appears during my animation?
问题 I'm learning Java by making a small game in a JApplet. I got a little problem with my sprite's animation. Here is the code : this.sprite.setBounds(0,0,20,17); this.sprite.setIcon(this.rangerDown); for(int i = 0; i< 16;i++) { this.sprite.setBounds(this.sprite.getX(), this.sprite.getY()+1, 20, 17); this.sprite.update(this.sprite.getGraphics()); try{ Thread.currentThread().sleep(100); }catch(InterruptedException e){ } } It left some flicker during the animation. Once the animation end, the