views:

528

answers:

3

I have an application that runs in fullscreen mode and has been working fine. Now I need to add a simple, undecorated dialog and I'm running into trouble. If I run the application maximized but not in fullscreen, the dialog displays and functions as expected. When I switch back to fullscreen, the dialog will not display.

The dialog extends JDialog and only contains a JSlider and a couple of buttons. It is undecorated and not modal. (I disabled modality for testing purposes -- it was a pain to force exit the app every time the dialog blocked input.) I'm entering full screen mode using setFullScreenWindow(), passing in the main JFrame for the app. It doesn't make a difference if I set that very JFrame as the owner of the JDialog or not. Nor does it seem to help if I call toFront() on the dialog.

The dialog seems to be active -- especially since it blocks input if I make it modal -- but just not showing or being hidden. So, is there any obvious trick to displaying a JDialog in fullscreen mode? Something I might be overlooking or omitting?

If there's no obvious solution, I can post some code later. Unfortunately, I don't have time right now.

+1  A: 

Do you really want to be in full-screen mode for this app? That's more of a gaming feature - to get more direct access to the frame-buffer, I always thought. Have you read this tutorial:

http://java.sun.com/docs/books/tutorial/extra/fullscreen/index.html

Really seems to me not to be the best choice for a Swing app with child windows.

M1EK
Good stuff to think about, but, yes, fullscreen mode is mandatory, as per client spec. This dialog will be the only child window, so it's nothing really complex.
Clayton
A: 

And in fact, as M1EK alluded in his answer and I mentioned in a comment, Java applications in full screen mode will not allow other windows to show over them. The Javadoc API for GraphicsDevice reads:

Windows cannot overlap the full-screen window. All other application windows will always appear beneath the full-screen window in the Z-order.

In the end, I reconfigured my application so that it doesn't enter full screen mode until a bit later. This still gives me a fairly class presentation at the start and allows my JDialog to function as it should. The transition to full screen mode is quick and smooth, even in the "middle" of my app.

Clayton
A: 

JOptionPane.showInternalXXXDialog() methods render dialogs as JInternalFrames. Maybe you could consider using a JIternaFrame to simulate the dialog box.

Ustaman Sangat