Translucent loading overlay for JFrame

java, swing

Solution

Take a look at JRootPane and JLayeredPane http://docs.oracle.com/javase/tutorial/uiswing/components/rootpane.html#layeredpane

What you're asking about specifically sounds like a Glass Pane. http://docs.oracle.com/javase/tutorial/uiswing/components/rootpane.html#glasspane

The Glass Pane prevents interaction with underlying components and can be used to display something on top of your JFrame.

Problem

I have a JFrame containing various components and I would like to add a translucent grey overlay over the top while the application is initializing various things. Ideally it would prevent interaction with the underlying components and would be able to display some "Loading..." text or a spinning wheel or something similar. Is there a simple way to do this using Java and Swing?

Original source

Related problems