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



I wrote:

>Other than that, I see nothing wrong with Jog.java's painting code.  It
>may be worthwhile to look farther up the component hierarchy.  Maybe it's
>some OTHER component that's wrong, and it's screwing up the Graphics
>context for the Jog component, or Job's subtree.

Here's another change in a different direction.

I'm assuming an instance of Jog is the non-opaque component implied by the
Subject line.  If so, then I see no reason why it has to be non-opaque, at
least not in the layout for the screen-shots previously posted:
  <http://lists.apple.com/archives/java-dev/2006/May/msg00507.html>

The Jog knob occupies a rectangular area, with no incursions and no other
elements layered behind it.

So in this case, try adding code to Jog.paintComponent() that first fills
its entire area with a solid background color (obtained from parent, if
necessary), then paint the existing rendering directly on top of that.  One
approach is to rename paintComponent(Graphics) to paintKnob(Graphics), then
define a new paintComponent() that fills the area with the bkgd color then
calls paintKnob(), where neither one calls super.paintComponent().

The purpose of this is to see if the problem is related to the non-opacity,
or possibly to super.paintComponent(), which should be doing nothing but
may be causing a side-effect.  If the problem then goes away with the
opaque non-super-calling version, then enable either the non-opacity or the
call to super.paintComponent() and see if it still works.  If so, disable
that one and enable the other, until the problem comes back.

That should narrow down what the problem is related to, unless it's related
to both or neither.  But even if you discover it's both or neither, it's
still progress.

Granted, painting a solid bkgd then a knob on top of it may flicker during
knob-drag updates.  The purpose isn't to have an optimal rendering pathway,
but to divert rendering from it's current pathway and see how that affects
the placement of the sub-elements, if at all.

Just a thought.

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