Search code examples
javaswingjframetranslucency

Make a JPanel transparent to see behind the frame?


I know how to do a shaped or a translucent JFrame, but I would like to have a rectangular zone in my frame which would be translucent so the user can see what is behind. I don't know how to do that and take a screen capture of what is behind the frame is not working for me, because I want really that the user see dynamical change behind the frame.


Solution

  • but I would like to have a rectangular zone in my frame which would be translucent so the user can see what is behind.

    • JFrame has a BorderLayout, BorderLayout has 5 areas,

    • take this advantage from BorderLayout, create a Translucent JFrame and leave the CENTER area translucent, put an opaque Panel in the the other areas.

    • mabye now, there is real reason to mix AWT (doesn't support transparency & translucency) with Swing, you can put AWT Panels to the NORTH, SOUTH, EAST and WEST areas

    a screen capture of what is behind the frame is not working for me, because I want really that the user dynamical change behind the frame.