CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2010
    Posts
    1

    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.

  2. #2
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    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.

    ps. I can't overload paint method because I got object of class HeavyComponent that is subclass of Canvas.
    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?
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured