See chapter two of

Killer Game Programming in Java 

For examples and discussion of exactly this topic.

http://www.oreilly.com/catalog/killergame/toc.html



-----Original Message-----
From: Discussion list for Java 2D API
[mailto:[EMAIL PROTECTED] On Behalf Of Java Questions
Sent: Friday, June 10, 2005 8:07 AM
To: [EMAIL PROTECTED]
Subject: [JAVA2D] Simple way to animate an image sequence on a JPanel ?


Hi everyone,

<Warning: newbie questions ahead !!!>

I would like to display a sequence of Image on a JPanel at a given frame
rate (around 30 fps). Right now I am doing this the "not-so-subte" way:

destinationJPanel.getGraphics().drawImage(imageToDisplay,
horizontalOffset, verticalOffset, this);

In othe words, every time my timing controller tells me it is time to
update the display, I invoke the code above.

This works, however there are strong disadvantages in updating the panel
using such a "brutal" approach: the menus which are placed right above
the panel are unusable. When I try opening one of these menus, the "drop
down" list of options is "hidden" by the frames I draw.

I know I should be using some kind of double buffering but how should I
implement that ?

D.

PS: I'm stuck with jdk 1.4.2 for now so I won't be able to use any of
the nifty new features in Java 5 :-(

========================================================================
===
To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body of the message "signoff JAVA2D-INTEREST".  For general help, send
email to [EMAIL PROTECTED] and include in the body of the message
"help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to