posted 20 years ago
I have a paint method for a component in Swing.
I want to make the clip region in the Graphics object of the paint method to be some what larger than the original clipping region. I am using the following lines of code.
Rectangle old = g.getClip();
Rectangle clip = g.getClipBounds();
g.setClip(clip.x, clip.y, clip.width + 20, clip.height + 20);
clip = g.getClipBounds();
g.drawLine(clip.x, clip.y, clip.width, clip.height);
g.setClip(old);
But it seems that it is not working. I am not able to see the line in the new clipping region. The line appears in the old clipping region. What may be the reason.
Thanks,
Jana