How to reduce flicking in animation?
Answers were Sorted based on User's Feedback
Double Buffering
sample code of java to reduce flinking :
public void update(Graphics g) {
Graphics offgc;
Image offscreen = null;
Dimension d = size();
offscreen = createImage(d.width, d.height);
offgc = offscreen.getGraphics();
offgc.setColor(getBackground());
offgc.fillRect(0, 0, d.width, d.height);
offgc.setColor(getForeground());
paint(offgc);
g.drawImage(offscreen, 0, 0, this);
}
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / m. abhishek
By using offGra first draw whole animated image on a blank
Image and put this image directly on the screen
so at the time of animation the each movement of image can
draw
in other image and put this Image to screen.
| Is This Answer Correct ? | 0 Yes | 2 No |
What is the main functionality of Prepared Statement?
what is mean by synchronization?
3 Answers BOB Technologies, GCPL,
How we can generate random numbers in java?
what is the purpose of method overriding in java where v r completely re-defining a inherited method instead y can't v create a new method and define.If the question is very silly plz excuse me and do reply.Thank U!
7 Answers emc2, Kumaran Systems,
Which keyword specify that a variable is effectively final ?
Why is java multithreaded?
What are three types of loops in java?
Are arrays passed by reference in java?
What is the difference between the paint() and repaint() methods in java programming?
What are dot operator queries?
Which method you will use to create a new file to store some log data. Each time a new log entry is necessary, write string to the file in java ?
Which arithmetic operations can result in the throwing of an arithmeticexception?