Transarent background over heavyweight components
I've got a problem. In LayeredPane I have 2 components: heavyweight coponent and JComponent(or any other what I could draw text in) that is placed above the first one. I'd like JComponent to have transparent background, but it has black background. Heavyweight coponent is a component that renders video and JComponent is component what I draw text in. This text should be printed with transparent background.
I tried to use GlassPane but glass content of glassPane was displayed above lightweight components and below heavyweight component.
Is there possibility to draw text above heavyweight coponent (Canvas)?
ps. I can't overload paint method because I got object of class HeavyComponent that is subclass of Canvas.
Re: Transarent background over heavyweight components
There are issues with mixing heavyweight and lightweight components, particularly with regard to the Z order - see this article. Basically heavyweight components always draw on top of lightweight components in the same container.
Also heavyweight components are always opaque so you can't put a canvas above the video as it will obscure it.
Quote:
ps. I can't overload paint method because I got object of class HeavyComponent that is subclass of Canvas.
:confused:You don't need to overload the paint method you need to override it and why does the fact that it is a subclass of Canvas matter?