Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2007

Tip: Looking for answers? Try searching our database.

clipboard.setContents destroys clipboard.getContents?

Thread view: 
spunibard@gmail.com - 01 Mar 2007 21:16 GMT
when i'm using clipboard.setContents to reset clipboard information it
is breaking clipboard.getContents. (getContents will return whatever
setContents set regardless of the outside program putting information
on the clipboard. this was not a problem until setContents was added.
am i doing or expecting something wrong?

java.awt.datatransfer.StringSelection ss = new
java.awt.datatransfer.StringSelection(s);
       this.clipboard.setContents(ss, ss);

(...)

this.clipboardTransferable = this.clipboard.getContents(null);
       try {
           return
this.clipboardTransferable.getTransferData(java.awt.datatransfer.DataFlavor.stringFlavor).toString();
       }
Andrew Thompson - 02 Mar 2007 04:54 GMT
On Mar 2, 8:16 am, spunib...@gmail.com wrote:
> when i'm using clipboard.setContents to reset clipboard information it
> is breaking clipboard.getContents. (getContents will return whatever
> setContents set regardless of the outside program putting information
> on the clipboard. this was not a problem until setContents was added.
> am i doing or expecting something wrong?

I would need to see an SSCCE* to determine if
what you say (and the code) makes any sense.
* <http://www.physci.org/codes/sscce.html>

Andrew T.
spunibard@gmail.com - 02 Mar 2007 19:52 GMT
Thanks Andrew, you helped me figure this out- After writing an SSCCE i
found that my problem seemed to be outside of where i was looking.
(SSCCE worked great) eventually i found (i think) that because the
process wasn't running in it's own thread, it seemed to be getting in
the way of itself when it came to the clipboard owner changing. which
is odd (to me) because as long as the ownership of the clipboard
didn't switch to my program, the clipboard stayed current just fine.

> I would need to see an SSCCE* to determine if
> what you say (and the code) makes any sense.
> * <http://www.physci.org/codes/sscce.html>
>
> Andrew T.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.