Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

setClip() not working  RSS feed

Eureka Jana
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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);
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.
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!