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 notify() method of object class ?
What are heterogeneous objects?
Nullpointer exception is a very common exception. Why is it not made as a checked exception?
What are the Main functions of Java?
0 Answers Akamai Technologies,
What is meant by class loader? How many types are there?
Which package is always imported by default?
What is an association?
What is java and their uses?
How does class forname work in java?
does java support pointers?
What are different types of states exist for a thread?
explain local datetime api in java8?