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



Scott Palmer wrote:

>The remainder of this message is quoted from http://java.sun.com/
>products/jfc/tsc/articles/swing2d/index.html
> ...etc...

Thanks, Scott.  That explanation coincides with my understanding of
non-opaque vs. opaque.  I didn't explain it nearly as well, though.

However, it still sounds to me like the observed behavior is not
inconsistent with the cited explanation of non-opaque painting:

> 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.

For example, if a non-opaque JLabel is placed at the top left corner of a
window, then that JLabel will render its content on top of whatever gets
rendered behind it in the containment hierarchy.  If the JLabel's parent
container doesn't render anything, or is itself non-opaque, then the JLabel
may render on top of garbage left over from earlier renderings.

Similarly, if the JLabel renders on top of a prior rendition of itself,
then the anti-aliasing and any other translucent pixels will darken more
than they should, and translucent colors will be brighter than they should
be.  The prior rendition of itself would also qualify as leftovers from
earlier renderings.

I think the answer may lie in what the JLabel's parent container is, and
whether it renders anything, or whether it leaves the pixels within its
area untouched, and so on up the containment hierarchy.  Without knowing
what's above/behind the non-opaque JLabel, it's impossible to tell whether
the observed behavior is correct or not.

As another reference, JRootPane.setContentPane() says:
     Swing's painting architecture requires an opaque JComponent
     in the containment hiearchy. This is typically provided by the
     content pane. If you replace the content pane it is recommended you
     replace it with an opaque JComponent.

  -- 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.