I don't know about global modal, but here's an idea.
- Take the screenshot of the desktop.
- Go full screen.
- Pop up your dialog.
Since the desktop is fake screenshot, you can ignore any attempt to click into it.
private void toggleFullScreenWindow() {
GraphicsEnvironment graphicsEnvironment
= GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice graphicsDevice
= graphicsEnvironment.getDefaultScreenDevice();
if(graphicsDevice.getFullScreenWindow()==null) {
dialog.dispose(); //destroy the native resources
dialog.setUndecorated(true);
dialog.setVisible(true); //rebuilding the native resources
graphicsDevice.setFullScreenWindow(dialog);
}else{
graphicsDevice.setFullScreenWindow(null);
dialog.dispose();
dialog.setUndecorated(false);
dialog.setVisible(true);
dialog.repaint();
}
requestFocusInWindow();
}