If I have a bunch of custom JComponents in the Swing panel, and each of them can contain many other JComponents, is there a way to "freeze" the redrawing of the top-level components and then unfreeze them, causing the redrawing?
I think I'm trying to do some kind of localized double buffering.
Also, just in case, the reason you do this is because you are doing a bunch of GUI updates for components and worried about all these automatically placed repaints (), don't do this. repaint () does not show off immediately; it sends a delayed redraw event to the AWT event queue, which combines several repressions for a given region to avoid repeating the same picture over and over again.
Overriding paint(Graphics)to do nothing if the flag is set will prevent the picture from appearing; You can also add your own double buffering by overriding drawing on the image.
paint(Graphics)
JComponent swing, setDoubleBuffered(boolean), , , .
setDoubleBuffered(boolean)
, , , ; ( ).