Win a copy of Practice Tests for OCP Java 17 Certification Exam (1Z0-829) this week in the OCPJP forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
Bartenders:
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

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
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic