I'm trying to take screen shots using java.awt.Robot, but not having
the best of luck on dual monitors setups. When I do so, the image
from the second screen is all black.
I'm assuming this is a bug, but before I filed one, I figured I'd let
you guys take a look to make sure I'm not doing anything silly.
Here's my test code:
-------------------------
public class ScreenshotTest {
public static void main( String[] args ) throws Exception {
GraphicsDevice[] devices =
GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices();
BufferedImage[] images = new BufferedImage[ devices.length ];
Robot robot = new Robot();
for( int i = 0; i < devices.length; i++ ) {
GraphicsDevice device = devices[ i ];
for( int i = 0; i < images.length; i++ ) {
BufferedImage image = images[ i ];
JFrame frame = new JFrame( "Image " + i );
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
frame.getContentPane().add( new JScrollPane(
new JLabel( new ImageIcon( image ) ) ) );
frame.setSize( new Dimension( 500, 400 ) );
frame.setVisible( true );
}
}
}
-------------------------
I get the same result with Java 5 and 6.
Thanks!
Rob
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden