How to make JFrame transparent?

Harry Joy picture Harry Joy · Jul 12, 2011 · Viewed 33k times · Source

How to make JFrame transparent? I want to make my JFrame transparent. User should see the background when my JFrame is on top of it.

Answer

drzymala picture drzymala · Nov 7, 2012

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 remember to set the opacity off of the contentpane (your JPanel or other component)

// turn off opacity of the content pane
yourContentPaneHere.setOpaque(false);