I have a JFrame in which I use Graphics2D to draw VolatileImage using this tutorial. I basically copied the code to see how it works, but slightly edited it for my game. I start my computer with two screens.
The problem occurs when I drag the game window onto another screen that did not initially appear in the window. The window turns gray and no graphics are displayed on the screen, even simple rectangles that I drew using Graphics2D. This only happens when I call the draw volatileimage method, as shown in the tutorial.
I believe this may have something to do with this ...
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsConfiguration gc = ge.getDefaultScreenDevice().getDefaultConfiguration();
... but I'm not sure.
Any help would be greatly appreciated :) It would also be interesting to know if VolatileImage is the way I should go for my game, or if BufferedImage or something else is the best method for performance and frame rate :)
source share