[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
java.awt.Robot example
Many people have sent me emails in response to a post I made 6 or 8 months
ago asking about examples of using java.awt.Robot
The post was titled:
Screen capture to an image file - GIF, JPEG, whatever
My question was about converting the BufferedImage object returned by the
createScreenCapture() method into something useful.
I never found a good example of this so I'll just whip out some quick code.
--------------------< cut >---------------------
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
Rectangle rect = new Rectangle(0,0,dim.width,dim.height)
Robot robot = new Robot();
BufferedImage bi = robot.createScreenCapture(rect);
--------------------< cut >---------------------
This is not the code that I used for my application but it should work and
looks pretty generic. You can flame me if you find a bug. :)
If anyone knows of a good example please post it. There seems to be a need
for one.
Chris
chris@abney.info
_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx