Add a transparent JPanel to the AWT component to draw

I have a problem: in my Java application, I have an AWT component (I can’t change it) that transmits and displays the avi file. Now I want to draw this film and think about having a transparent JPanel above it and draw it.

This does not work, as I either see the AVI stream, or the drawn lines, but not both.

I read somewhere that AWT does not support component transparency, but the panel is a JPanel that is able to do this.

Can someone please help me with this - thanks in advance.

+2
source share
4 answers

The Mixing Light and Heavyweight Components article explains how this is handled only in the most recent version of the JDK.

+2
source

Have you tried GlassPane since I think this is exactly the use case. soemthing like JFrame.setGlassPane () if I remember correctly. here:

Java API JFrame

GlassPane Examples

+1
source

I was looking for a heavy component that could help me, but I could not find it, and as for the internal frames, I don’t know how you managed to set the opacity to 50. All I found was opacity wast setOpaque method (boolean) and it doesn’t help me at all. Could you explain to me how you set this opacity. This is my last alternative, or I will have to change the whole project.

0
source

Try running Stream and Drawing in a separate stream. I think this may help.

0
source

Source: https://habr.com/ru/post/1336469/


All Articles