All is solved. I am posting here to hopefully help others with the same problem. I also want to thank Rob Camick, who goosed me out of my laziness to think more creatively about the situation. The code posted previously and below for copying a screenshot does indeed work. The reason that all of the screenshots were coming out black is that it was being invoked before the screen was actualized then displayed by Java. So the problem became one of finding when the screen had been displayed.
My solution can probably be improved greatly and
ant improvements would be happily received.. One might, of course put up an 'isShowing' loop for the entire period of construction, but that seems less good because it involves more execution. I am certain that there are better ways than my solution, but it does work, and only the very last part involves an 'isShowing' loop. The earlier and larger part is covered by a HierarchyListener. Before settling upon HierarchyListener, I tried ComponentListener, but after it failed to work, I found a number of posts online explaining that it will never work, and suggesting a Hierarchy Listener. So early in the construction of the JFrame, the following was executed.
The variable wdisp sits there waiting for the HierarchyListener to fire:
In the code below, main is the JFrame and cPane is the Component to be snapshotted, derived from the ContentPane of the JFrame. A
Thread is started, waiting for the HierarchyListener to fire, which it does upon execution of 'setVisible(true)' for the JFrame. But there is still a period during which the ContentPane is still not showing, although it is on its way up. This explains the double loop. And WatchDisplay is: