Skip to main content

full screen exclusive mode + JOptionPane

3 replies [Last post]
kumandus
Offline
Joined: 2009-08-12

HI!
I´am a newby and i am trying to insert a JOptionPane on a JFrame on full screen exclusive mode, i want to know if that´s possible, because the JOptionPane always stay in the back of the JFrame.
Could you help me out please?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
chrismcband
Offline
Joined: 2006-07-10

This isn't really a java3d problem, but an issue with full screen exclusive mode. Full screen exclusive mode was designed to get better performance by only rendering one window, doing away with the windowing system and just concentrating on the graphics for one window. If your using JOptionPane to display dialogs or messages, these are in separate windows so they won't be rendered in FSEM.
If all you want is your app to be full screen, just set your JFrame full screen by manually setting the dimensions obtained from the current display mode:
GraphicsEnvironment ge = GraphicsEnvironment.
getLocalGraphicsEnvironment();
GraphicsDevice gd = ge.getDefaultScreenDevice();
DisplayMode dm = gd.getDisplayMode();
int screenWidth = dm.getWidth();
int screenHeight = dm.getHeight();

Now you have the screen width and height you can set those dimensions on you JFrame and set it undecorated (don't display the window bar and border).

If you really do want to keep full screen exclusive mode you'll have to use use something else which renders within the same window. Take a look at the glasspane examples for drawing things on top of the same window. I suspect you're going to run into the problem of rendering swing components over a heavyweight canvas3d component though. See other posts for ways around that.

kumandus
Offline
Joined: 2009-08-12

Chris, i would like to thank you for your interest and promptly answer to my post. I am trying to do a litle game with full screen exclusive mode, what do you think of using JInternalFrame insted of the JOptionPane. I don´t know that much of glasspane, thank i will look the examples, but i didn´t understand the part of the problems. Thank´s for all

Message was edited by: kumandus

chrismcband
Offline
Joined: 2006-07-10

I've never used JInternalFrame before, but I guess it would work. However there were some issues running a java3d Canvas3D within a JInternalFrame. I don't know whether this is still the case but there used to be a problem with the canvas always being rendered on top. This is still due to the heavyweight vs. lightweight problem I mentioned in my previous reply. If this problem still exists with JInternalFrame then you are going to run into it, basically people have reported that the Canvas3D always renders even if it is in the bottom-most JInternalFrame.

If you are trying to get the 3D stuff full screen and every now and then popup a message box or something, why not do it using a sort of heads up display? You can draw ontop of the Canvas3D using a Graphics2D object by overriding the postRender() method of Canvas3D. In there you can draw on top of the canvas, whatever you like, providing its not too big. There are other posts about this, search for overlay or heads up display.

If this isn't what your doing and you just need different windows which don't need to overlap then you can go with the internal frames, but when your user tries to overlap the windows they could experience the problem above.