Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Non opaque component painting bug



Florijan Stamenkovic wrote:

>I experience a painting glitch in the top left corner of my windows,
>if there is a non opaque component placed there, for example a
>JLabel. By "glitch" I mean things like a scroll bar appearing as the
>background of the text, or two times painting the anti-aliased text
>which causes it to look bolder.

I may be wrong about this, but it sounds to me like it's working exactly
the way it should.  I think non-opaque means exactly that: i.e.
transparent.  That means the area assigned to the component will not be
erased or filled with any background color before the component itself is
painted.

One consequence of this is that the transparent component then becomes
responsible for clearing any old leftover paint or "debris" from its area
before each full or partial paint of itself.  The exact way to handle this
would depend on how the component's area changes.  If the area increases in
any direction, then the new area may well contain leftover pixels (debris)
from another component that previously occupied that area.  If the
transparent component doesn't do something to clean it up, then you get
overpaint.  This strikes me as exactly the behavior one should expect from
a transparent, non-opaque component.

If a non-opaque component can't handle the clearing by itself, then it
shouldn't be non-opaque.  Or it should rely on an opaque container behind
itself (a parent container) to clear the area for it.  Or some similar
strategy that otherwise handles the fact that the non-opaque component will
only overpaint and never clear first.


>Only using opaque components seems to be a solution there, but I
>would prefer to avoid that.

Why avoid opaque components?  Exactly what are you trying to accomplish by
using a non-opaque component?

If we know what effect you're trying to accomplish, we may be able to
suggest alternative solutions.

  -- GG


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.