Custom graphics repainting
Posted on 2003-03-07
I have a JPanel on which custom graphics are painted using Graphics2D. Sometimes the graphics will take a few seconds to draw, but the JPanel is blank until everything has been drawn, then the custom graphics are displayed.
I would like the JPanel to display the graphics as they are being drawn so the user can see what is being drawn instead of looking at a blank screen for sometimes 5 or 6 seconds. Using just Graphics (as opposed to Graphics2D) and a Panel, it did this automatically, but now (because of Swing double-buffering I think?), it doesn't.
Is there a way in which I can force output to the screen as its being repainted, without losing the double-buffering?