I'm having trouble with a plugin that repeatedly updates some drawing that
I'm adding to an image. For each update, I call imp.draw(); to erase the
old version of my added artwork, and then I recreate the artwork. The
problem seems to be that imp.draw(), which ultimately calls repaint() for
the image canvas, seems to run asynchronously. That is, imp.draw() launches
a repaint process that goes on its way, my plugin redraws the artwork, and
then the still-running imp.draw() erases part of it. This creates an
annoying flicker effect on some computers. Sun's API suggests that Swing
has double buffering, which might be related, but it seems like overkill.
Is there an easy way to redraw the graphics from the image data that is
blocking? I think this issue has come up before, but I was not able to find
it in the archives.
imp.draw();
for (int j = 0; j < rows; j++){
for (int i = 0; i < columns; i++){
int ind = i + columns*j;
int diam = (int)(ic.getMagnification()*diameter);
g.drawOval(ic.screenX(x[ind]),ic.screenX(y[ind]),diam,diam);
}
}
Bob
Robert P. Dougherty, Ph.D.
President, OptiNav, Inc.
[hidden email]
(425) 467-1118