Java transparent JFrame, JVLC and java.awt.Canvas

1.2k Views Asked by At

I am trying to achieve an effect of transparent JFrame on top of video stream provided JVLC library. Background is an instance of java.awt.Canvas Foreground is my whatever JFrame with a couple of controls on it.

rootPane.setForeground(myFrame); rootPane.setBackground(myCanvas);

JVLC uses my canvas through JNA like this jvlc.setVideoOutput(myCanvas); jvlc.apply();

I expect myFrame to be always transparent to myCanvas. Any ideas how to get this work?

1

There are 1 best solutions below

0
Jonathan Feinberg On

You can't (reliably) mix lightweight Swing components, such as JPanel, with heavyweight native components, such as Canvas. If you want to display a JPanel, you'll have to add it (ultimately) to a JFrame or a JWindow.