How to reduce flicking in animation?

Answers were Sorted based on User's Feedback



How to reduce flicking in animation?..

Answer / m!r@

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

How to reduce flicking in animation?..

Answer / tarush1988

double buffering

Is This Answer Correct ?    0 Yes 0 No

How to reduce flicking in animation?..

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

Post New Answer

More Core Java Interview Questions

what is aggregation in java?

0 Answers   IBS,


Can main() method in java can return any data?

0 Answers  


What is serializable interface?

13 Answers   Infosys, Probity Soft, Seed Infotech,


Can we declare a class as static?

0 Answers  


What is map in java?

0 Answers  






Which package is imported by default?

0 Answers  


Describe how to implement singleton design pattern in struts.

0 Answers  


Can we have any code between try and finally blocks?

0 Answers  


what is multithreading?

5 Answers   Virtusa,


What is the difference between arraylist and hashset in java?

0 Answers  


Why is the main method static?

0 Answers  


How will you print number in reverse (descending) order in BST.

0 Answers   GrapeCity,


Categories