This problem had been partially addressed before in this bug:
6600226: D3D: Repainting Issues while resizing a Swing application
The work around used in that bug was to check if the size of
the component changed and don't do the flip if it was.
However it is not enough since the size of the window
may change after our check and before we do the flip.
So instead I propose to check this right before the Present
in the native code. Since Present is executed on the toolkit
thread the window's size couldn't be changed between our check
and call to Present.
So if we detect that the window size changed we
just don't do Present. This is OK since there is another paint
even coming which will repaint the newly exposed area.
In order to limit performance impact we will only enable
the work around on Windows Vista.
This may also need to be revisited later if we decide to
change the way we create backbuffers for swap chains.
Currenlty we create them the size of the window instead of
the client area.