I have a class that extends Canvass that I use to display a histogram. The user can "drag" lines that are drawn over the histogram which is repainted when the mouse is moved. I noticed a flicker and wanted to draw the histogram only once in a back buffer and use it as a background for the lines drawn from the mouse move. I attempted to adapt from an example but now all I get is a light grey background. Here's some abbreviated code.
This is my first shot at using a back buffer in Java - can anyone suggest what's wrong?
I figured it out and the flicker is gone as I wished!
The back buffer and the lines (there's more to this than my abbreviated code of course) need to be drawn to the component Graphics object.
I had experimented with both an extended JPanel and an extended Canvas before I decided on a Canvas but can't remember exactly why - but Canvas does what I want.
BTW I did all of this in the '90s in Borland C working in Windows 98 and later Windows 95. I got it working but never did understand the graphics well. Java is better IMHO as I can understand what I'm doing.