Re: Custom JPanel that clips children?
- From: Thomas Hawtin <usenet@xxxxxxxxxxxxxxxxx>
- Date: Fri, 26 Aug 2005 21:02:30 +0100
Arabella wrote:
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.
I'd expect paintChildren to work. You should be able to trace back where the child components are painted from. For instance using Thread.dumpStack(); is you are not using a debugger. You should be able to see what is happening in each method.
Some Swing painting erroneously uses setClip which will clear any user clipping region. It's difficult to get screen corruption without disabling double buffering, but it'll ignore your clipping region.
Tom Hawtin -- Unemployed English Java programmer http://jroller.com/page/tackline/ .
- References:
- Custom JPanel that clips children?
- From: Arabella
- Custom JPanel that clips children?
- Prev by Date: Re: getting rid of text in TextArea
- Next by Date: Re: Timer event appears to move window
- Previous by thread: Custom JPanel that clips children?
- Next by thread: Re: Custom JPanel that clips children?
- Index(es):
Relevant Pages
|
|