Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

System Clipboard

  Asked By: Donna    Date: Apr 06    Category: Java    Views: 472

I would like to know how to get the source name of what I copy to
the clipboard. For example, I copy some part of
http://www.hotmail.com, maybe include image or link, how can I know
that what I copy is from http://www.hotmail.com. I encounter the
problem - when link or image src are used as relative filenames-
Looking forward to hearing your help.



3 Answers Found

Answer #1    Answered By: Evelyn Hughes     Answered On: Apr 06

You want to make a bitmap of screen ?

if yes, then try this code.
Toolkit toolkit = Toolkit.getDefaultToolkit();
Dimension screenSize = toolkit.getScreenSize();
Rectangle screenRect = new Rectangle(screenSize);
// create screen shot
Robot robot = new Robot();
BufferedImage image  = robot.createScreenCapture
// save captured image to PNG file
String imageFileName = File.separatorChar
+ "Automation" + File.separatorChar + outFileName ;
ImageIO.write(image, "png", new File(imageFileName));
// give feedback

Answer #2    Answered By: Douglas Sullivan     Answered On: Apr 06

Intereting, I never knew about that class(Robot). Does it do the
actions on screen or just in the memory?

Answer #3    Answered By: Cambria Lopez     Answered On: Apr 06

Action on screen. It works same way as "PrtSc" works. There should
be one button on your comp says "Print Screen" or "PrtSc" press that
key and open the paint and past it there. the output you there is
same think this code does.

Didn't find what you were looking for? Find more on System Clipboard Or get search suggestion and latest updates.