Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Flickering of Canvas

 
manu g
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have used AWT for constructing a ImageDrawing tool,for that i used a canvas as the drawing pad.in my tool box i have options such as Line,Circle,Rectangle,Freeline etc.the method which i am using is as follows
1.i record all the points in which line or circle is drawn
2. all the points are recorded in a Vector
3.every time i finished drawing something i redraw all the points that ihave recorded earlier
Now the problem is
------------------
after a lot of drawing the canvas flickers which unables me to see what i am drawing,i used update() in the code,but it shows me another problem,when ever i draw a colorline or something else
it shows me a number of lines,after minimize if i maximaize the scren it shows the correct image ie what i have drawn,removing all other lines
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Manu,
It sounds like you are having refresh problems.... you need to override update() ( if you have not already, you mentioned something about using update in your post. ), and use double buffering. Double buffering is an offscreen image that you draw to and then send to the screen all at once, so the user will not see the redraws.
Here is an example of how you would do it.
 
manu g
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank u for ur reply it did work very well,hoping 2 get ur help more
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic