Custom JPanel that clips children?



I'm trying to implement a JPanel with rounded corners that clips it's
children so they don't run outside the jpanel's (now rounded) corners.

I'm able to clip the JPanel, but the children keep painting outside the
jpanel parent.

Do I have to override the paint routines of every child, or is there a way
for a parent to clip children?

I tried overriding every paint method I could find, I even tried commenting
out the contents of every paint, repaint, print, update, etc method and the
child is still leaving artifacts outside the parent.

-A


.



Relevant Pages

  • Re: Custom JPanel that clips children?
    ... Christian Kaufhold wrote: ... >> I'm trying to implement a JPanel with rounded corners that clips it's ... >> I'm able to clip the JPanel, but the children keep painting outside the ...
    (comp.lang.java.gui)
  • Re: Custom JPanel that clips children?
    ... I'm able to clip the JPanel, but the children keep painting outside the jpanel parent. ... Do I have to override the paint routines of every child, or is there a way for a parent to clip children? ... I tried overriding every paint method I could find, I even tried commenting out the contents of every paint, repaint, print, update, etc method and the child is still leaving artifacts outside the parent. ... Some Swing painting erroneously uses setClip which will clear any user clipping region. ...
    (comp.lang.java.gui)