I'm using the vlcJ library to play videos in my program from another VLC
process (OutOfProcess player). The vlcJ Canvas
to play the video is embedded in a Component
in a JTabbedPane
. When the player is initialized, the video canvas comes to front on top of every other control.
I read about heavy-/lightweight component, so I know, that JRE
1.8 isn't still able to handle heavyweight components correctly, when drawed by another process embedded in lightweight components.
Embedded heavyweight components must belong to the process that created the frame or applet. The heavyweight component must have a valid peer within the main process of the application (or applet).
So my question is how to fix this issue, so that the Canvas
will not come to front "unasked"?
The tab "Multimedia" hosts the video canvas. Despite another tab is open, the canvas stays on top of everything. When the host tab "Multimedia" is opened once, the video canvas behavave correctly and stays in its tabs.
With the help of @MadProgrammer and @caprica i was able to figure out a workaround: Since I'm using an OutOfProcess Player with vlcJ-pro
i can't use the "direct" aproach, because player and canvas are not the same process.
Hide and show the video canvas is also no option, because the component, where the video images are drawn has to be visible all time (otherwise serious exception occur).
So finally i wrapped my video canvas into a JPanel
with CardLayout
and i switch between an empty pane and the video canvas. Every time a tab with mediaplayer is opened, the video canvas becomes visible, else the empty pane.
This workaround seems to work fine.