I have made a class called ProgressGUI, which is an extension of JDialog. Right now, I am attempting to get an instance of ProgressGUI to show progress as the values of a function are stored into a cache (so that the values don't have to be computer again upon regraphing of the function). However, when the ProgressGUI pops up, its contents are not rendered properly...
The ProgressGUI window pops up okay, but then all of its content area shows up white, and the progress bar doesn't show at all. I'm confused as to why this is happening... No errors occur and the dialog goes away when all the values have been stored into the cache.
For more clarification, here's the code using the ProgressGUI:
public void setFunction(String equation) { func.function = equation; repaint(); valueCache = new double[(int)((xMax - xMin) / xstep)][(int)((yMax - yMin) / ystep)]; ProgressGUI p = new ProgressGUI("Storing Values", "Computing and storing to cache..."); int n = valueCache.length * valueCache.length; int f = 0; for(int x = 0; x < valueCache.length; x++) { for(int y = 0; y < valueCache[x].length; y++) { valueCache[x][y] = func.evaluate(xMin + x * xstep, yMin + y * ystep); p.setProgress((++f * 100) / n); } } cacheReady = true; p.dispose(); }
See the images below for what it is supposed to look like, and what it's doing...
The ProgressGUI is small and in the center, but you'll get the idea.
Bad...
progress-bar-bad.jpg
Good...
progress-bar-good.jpg
Any help would be appreciated!