This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
i have been looking for a way to get the contents of the System's clipboard into a log file, after a few moments i was having a look at the java.awt.datatransfer package and related tutorials on the sun website.
i have one question though, while it seems quite easy and straight forward to retreive text from the clipboard (the global one) is their a way to be notified whenever the contents of the clipboard change For example: if the user copies, cuts or pastes text can the Java application be notified ?
if so there are methods for cut/copy/paste where you add your notification code
Joined: Sep 27, 2005
thanks for the advice michael, i think, i didn't explain my problem correctly and i apologize, i'd just like to know if a java application can "observe" the system clip board and be notified even if the java app is in the background ...
imagine you're copying text from a text file or a link in a browser, could the java app be notified ?
Please revise your display name to meet the JavaRanch Naming Policy. To maintain the friendly atmosphere here at the ranch, we like folks to use real (or at least real-looking) names, with a first and a last name.
Have the class that owns the content posted to the clipboard implement the ClipboardOwner interface. This registers your class as an owner of the Clipboard and it will receive notice when someone else has asserted ownership of (ie, posted data to) the clipboard.