• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

setClip() not working

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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);
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
 
And will you succeed? Yes you will indeed! (98 and 3/4 % guaranteed) - Seuss. tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic