Hello,
make sure that your transparent panel has opaque property set to
false.
For more info, check out this article:
http://java.sun.com/products/jfc/tsc/articles/swing2d/index.html
Thank you,
Dmitri
On Mon, Aug 11, 2003 at 09:59:39AM -0500, Ted Hill wrote:
> Hello,
>
> I am seeing some 'distortion' when painting in a transparent panel.
>
> What I have:
> =========
> I have an opaque JPanel that displays a buffered image. The image can be
> zoomed and panned using the AffineTransform.
>
> I have another transparent JPanel which is added to the parent JPanel
> mentioned above. It also overrides paintComponent(g) and draws some
> strings on top of the BufferedImage in the parent panel. Because the
> child panel is transparent, the parent's BufferedImage 'shows through'
> beneath the Strings. The transparent child covers about 20% of its
> parent and is positioned along the right hand border of the parent
> panel.
>
> The transparent panel is not always visible. When mousing into a certain
> area of the parent panel, it is set visible and then it draws some info
> Strings on top of the parent. When mousing out of the 'trigger' area,
> setVisible(false) is called on the transparent child.
>
> What I see:
> I *occasionally* get a "lens" effect when "looking through the
> transparent child" at the BufferedImage below. That is, depending on the
> scale and translation values of the parent, there appears to be a tiny
> shift in the image of perhaps one-pixel.
>
> For example, if I mouse in and out of the area that activates the
> transparent child, the underlying image is sometimes seen directly on
> the parent panel and sometimes viewed through the transparent child. As
> the state changes, I see the shift mentioned above.
>
> Changing the zoom and pan by only a small amount will often cause this
> "lens" effect to disappear. Then changing them again by a small amount
> will cause the effect to reappear.
>
> That is, at certain scale and translation values, I never see the lens
> effect, at others I do.
>
> What I'm wondering:
> Could this be caused by some kind of pixel round-off calculation in the
> child? (Perhaps my child panel is not aligned with its parent on a
> pixel boundary?) If so, is there some way to prevent this?
>
> My code base is very large, so unfortunately I can't post a working
> example of this.
>
> Thank you for your help,
>
> Ted Hill
>
>
>
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff JAVA2D-INTEREST". For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".