<Swing Dev> Painting a JComponent without clipping children
Alexander Potochkin
Alexander.Potochkin at oracle.com
Fri Jun 3 14:13:09 UTC 2011
Hello Herve
I don't really get it why you need to avoid setting the clip,
but anyway the following may be interesting to you
http://www.pbjar.org/blogs/jxlayer/jxlayer40/
Piet is transforming Swing components using JXLayer component
Thanks
alexp
> (reposted from awt-dev list, I picked up the wrong list before)
>
> Hello,
>
> I'm new to this mailing list and I'm not *really* asking how to do it
> because I know how it's possible to do it by using a hack (mainly
> getting and setting the BUFFER and TILE parts of the "flags" field for
> the JComponent by reflection, and "rewriting" the paintChildren method
> without the clipping part). I'm using it in the
> http://sourceforge.net/projects/j661/ project to be able to use
> custom Swing containers which only offset the position or transform
> their children graphic context, without clipping them (allowing to use
> negative positions for the children widgets, for example).
>
> I'm asking if there is a way to do this without playing with the
> private "flags" field, because I need to be able to do the same thing
> in a restricted JNLP environment. I know a "regular"' way to do this,
> but it would be a little cumbersome (offsetting the positions of all
> children widgets in the parent container, to be sure that the
> positions of the children are never negative, for example). But it's
> not very good for performance when something change in the parent
> container....
>
> There are many projects which either play with this private field, or
> use transforms, but in this later case they still apply a clipping. Is
> it possible to play with the Graphics2D clippings for example before
> using the JComponent paintChildren method - or would this approach
> work ? Or would the only way to do it without compromising Security
> be to have a way to get / set the TILE and BUFFER value of the "flags"
> field without reflection ?
>
> Thanks by advance if you have ideas about this, and sorry if this
> prose is not crystal clear ;)
>
> Regards,
>
> Herve
>
More information about the swing-dev
mailing list