It seems like what you are trying to do is implement a form of double buffering, where instead of your graphics being drawn directly to the screen, it is drawn in your computer's memory and then simply "flipped" over or copied to your screen.

If you want to set up your sprites before drawing them, I suppose you could load them in your program's initialization phase, either the constructor if you are making an Application, or init() in an Applet.

Some other solutions to this:

1) If you are looking for a full-fledged animation loop, complete with double buffering, you might want to check out Chapter 1 of this book-in-progress:http://fivedots.coe.psu.ac.th/~ad/jg/.This chapter also covers totally ignoring paint() altogether so you can perform your own graphics drawing whenever and wherever.

Hey Smarto, thanks for those links. They look pretty good, I'll have to check them out.

Basically I want to do a form of double buffering. I want to use a background image and then add seperate sprite images the background to form the final image. I plan to use these as seperate images, not quite double buffering, and use dirty rectangles to only update the areas that I want.

But that doesn't matter. Right now, I only want one thing. How can I get the bit depth and color mode of the display so I can match it with my images I create?

I changed my original post to better say what I ment (you are right, I wasn't too clear the first time).

Scroll down a bit to where I talk about how to get managed BufferedImages. With that strategy, you can ask for a BufferedImage with Translucency.WHATEVER constants which will be compatible with the current display.

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org