• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to paint selected area in the JPanel

 
Ketan
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We are developing Graphics based application where we need to call repaint method again and again. Now repaint method repaints the whole screen but we want it to repaint only a portion of the Screen keeping reamaining part painted. Is it possible ? if yes then how ?
Thanking You in Advance,
Javaquest
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
javaquest,
Welcome to JavaRanch!
We ain't got many rules 'round these parts, but we do got one. Please change your display name to comply with The JavaRanch Naming Policy.
Thanks Pardner!
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to look into clip regions... the Graphics class has the setClip() method to specify the region you want to draw to, and there are ways to test whether something is in the clip region, etc.

-Nate
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!