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 |
Explain the access modifiers for a class, method and variables?
Explain in detail about encapsulation with an example?
Hi i am creating desktop application in that i want calling to mobile number. i have java telephone api (JTAPI) but i dont understand how it configure & use plese help me
What is serial version uid and its importance in java?
What is variable and its types?
Why method overriding is used?
Why should I use abstract class?
Explain Big-O notation with an example
make a method which any number and any type of argument and print sum of that arguments.....
What does it mean that a method or field is “static”?
What does sizeof return?
how and when compiler knows that the Java code throws the checked Exception.