Is there any way to make a Canvas be double buffered?

Sandip Chitale

Yes. Same as any other component i.e. creating an offscreen image of same size. painting on that image's graphics and then copying it to the graphics of the Component.

[NOTE: Mind the size of the Canvas though, which will be by default zero due to default getPreferredSize() returning 0 x 0 size or layout manager not streaching the canvas. You will need to override getPreferredSize() to return the correct size that your component needs!]

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact