I found another solution.
Set the background color of your frame to
// Set the frame background color to a transparent color yourFrameHere.setBackground(new Color(0, 0, 0, 0));
And don't forget to set the opacity in the content area (your JPanel or other component)
// turn off opacity of the content pane yourContentPaneHere.setOpaque(false);
drzymala
source share