Flicker problem during zooming action
Hello fellow Java gurus,
I've been working on a project and reusing graphics code from a third party for a particular GUI that I'm currently building. The code that I am reusing is a graphing tool called PtPlot which is part of the Ptolemy package found at this link: http://ptolemy.eecs.berkeley.edu/java/ptplot/
My application is very dymanic and is intended to have a very busy display, one which will be continuously populated with hundreds of thousands of points and millions worst case. My display is also continually refreshed at a predefined rate and can be zoomed in and out at user's discretion.
PtPlot contains classes such as Plot.java and PlotBox.java and are mainly for static graphic displays. They have their own zoom, pan and other graphing functionalities. A class called PlotLive.java was what interested me. Further study of this class revealed that it wasn't the dynamic graphing tool I was looking for.
My prototype application seemed to work ok. It still needs performance boosting, but the main problem occurs during zooming. You guys obviously know that during a conventional zoom, a rectangle is drawn around the area the mouse was dragged over. Now, using the classes mentioned earlier for static graphical displays the rectangle drawn is perfect, smooth and zoom works well. However, for dynamic displays, because I am refreshing the screen at a fast rate, the zoom rectangle that is drawn is repeatedly being refreshed as well, causing a flicker effect, and the rectangle no longer looks like a rectangle. The zoom function works regardless though, but I don't want the customer to zoom in and not be able to see a clear rectangular zoom area.
So basically the problem occurs because the screen in continuously being refreshed. I'm not sure how to fix this because the code I'm reusing is so complex and so suited to static displays. Any ideas anyone?
Also, do any of you know whether my problem could be solved by taking advantage of hardware accelerators? I'm still new on the subject of such things by the way. Thankyou. Any feedback is much appreciated.