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 do you understand by an io stream?
What is a top level class in java?
Hi Friends, I am beginner in java. what i know about synchonized keyword is,If more that one 1 thread tries to access a particular resource we can lock the method using synchronized keyword. Then after that how the lock is released and how next thread access that.Please explain with example.
Why do we use threads in java?
What are synchronized methods and synchronized statements in java programming?
What class is used to implement a Throwable array?
what is meant by string pooling?
12 Answers Oracle, Polaris, Tribal Fusion, Wipro,
What are the advantages of unicode?
Why Java is not purely object oriented?
50 Answers Elitecore, Persistent, Reliance, Wipro,
What are JVM.JRE, J2EE, JNI?
What do you mean by jjs in java8?
How to convert String into primitive datatype.