• 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

Flickering of Canvas

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank u for ur reply it did work very well,hoping 2 get ur help more
 
Not so fast naughty spawn! I want you to know about
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic