First the request. The GenericDialog/NonblockingGenericDialog wants to
assign an ImageWindow as its parent. One of the effects of this is that
this ImageWindow is raise(d) when the GUI is activated. For the
GenericDialog this is not an issue as the GUI is always active, until it
is gone, AND, there is an Java API to assign a benign Frame instead of the
current ImageWindow. For the NonblockingGenericDialog this ImageWindow is
raised everytime the GUI is raised and there is no API to assign a benign
alternative. Could there be an NonblockingGenericDialog API to allow the
Java programmer to set a benign Frame as its parent?
Second the question. I am trying to get screen capture of a GUI window
using Robot. Everthing works fine IF the window to be captured does not
lose focus after the GenericDialog instagating the screen capture closes
and Robot captures the screen. If the window to be captured loses focus,
the screen that gets captured is the one that was current at the moment
the OK button was clicked; this is even though the screen has been
properly updated before the Robot.createScreenCapture. Everything that I
have tried has not changed this scenerio. Note that this works the same
with ImageWindow(s). The reason I am concerened is that a win.toFront is
done before the screen capture.
1) Has anyone experienced this exact issue?, and if so, how to fix?
2) Is there a way to prevent a focus change between the toFront and
3) Is there some sort of double buffering going on that can be requested
to update so what is captured is current?
The below plugin can be used to reproduce the aformentioned issue.
Although it depends on GUI interaction timing and refocusing, so it may
take a few tries to reproduce. Have the below GUI, or something else,
cover the to-be-captured window before clicking OK.