B
Bob Jackson
Hey guys,
I am attempting to achieve flicker-free animation, but am having some
issues. I created a JFrame containing a JPanel. I overrode the JFrame's
paint() method to display a background image in the JPanel and then
superimpose another image on top of it (a car that moves). Unfortunately,
whenever there is movement, both the background and car flicker. I don't
quite understand why this is occurring - JFrame's update() description
indicates that it does not clear the screen so I thought that wouldn't have
been the issue (I overrode the update to just call paint() just for good
measure also). A couple interesting/perplexing observations: When I remove
the super.paint() call in my overridden method, the flickering stops (of
course I then don't get a couple of button's drawn on the screen like I want
either) and I also tried making setting the opaque flag of the JPanel to
false, but that didn't do anything. Can anyone offer any advice?
Thanks
Bob
I am attempting to achieve flicker-free animation, but am having some
issues. I created a JFrame containing a JPanel. I overrode the JFrame's
paint() method to display a background image in the JPanel and then
superimpose another image on top of it (a car that moves). Unfortunately,
whenever there is movement, both the background and car flicker. I don't
quite understand why this is occurring - JFrame's update() description
indicates that it does not clear the screen so I thought that wouldn't have
been the issue (I overrode the update to just call paint() just for good
measure also). A couple interesting/perplexing observations: When I remove
the super.paint() call in my overridden method, the flickering stops (of
course I then don't get a couple of button's drawn on the screen like I want
either) and I also tried making setting the opaque flag of the JPanel to
false, but that didn't do anything. Can anyone offer any advice?
Thanks
Bob