GUI applications aren't designed to be continually resized... Only recently, on Windows at least, one is able to resize a window while still seeing what is inside. Before that, the window was blanked until the user released the mouse. Some window systems only shows a skeleton to show the current frame size, keeping the original size unchanged until the end of the action.
On Windows 7, if I resize the side of my text editor (written in C++ with native Windows calls), the content is relatively stable but I see the scrollbar and the status bar to flicker a lot.
In your sketch, there might be a conflict between the normal Processing cycle (redrawing the content at the end of draw()) and the redrawing asked by the resize operation, at a variable rate.
If I delay the latter, it flickers a little less, although still a bit:
- javax.swing.SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- frame.setSize(200,windowHeight);
- }
- });
As you saw, I doubt there is a good solution, as we cannot control the system's redrawing. And that probably won't be fixed by the designers of the system as, again, GUI are not designed for such behavior: a little flickering isn't important when resizing manually, and continuous, programmed resizing is quite uncommon...