I would like to expand on the previous answer with the following. This will create a window with a transparency of 0.05 or 12.75 out of 255. Then the components will be set to a transparency of 0.50f, this will only affect clicked components. Without clicks like shortcuts, their transparency can be set. However, this fixes problems with clickable components that it changes colors.
JWindow subFrame = new JWindow();
subFrame.setBounds(0, 0, 500, 500);
subFrame.setAlwaysOnTop(true);
subFrame.setOpacity(0.50f);
subFrame.setBackground(new Color(1.0f, 1.0f, 1.0f, 0.05f));
JButton button = new JButton("Hello");
button.setBounds(20, 180, 100, 40);
subFrame.getContentPane().setLayout(null);
subFrame.getContentPane().add(button);
subFrame.setVisible(true);
source
share