See Glass Panel for an example and explanation .
In general, your glass glass can use a transparent background:
JComponent glassPane = new JPanel();
glassPane.setBackground( new Color(240, 20, 20, 100) );
frame.setGlassPane( glassPane );
Then, when you want to show the dialog, the base code will be:
glassPane.setVisible( true );
JDialog dialog = new JDialog(...);
dialog.setVisible( true );
glassPane.setVisible( false );
source
share