clipboard.setContents destroys clipboard.getContents?

Discussion in 'Java' started by spunibard@gmail.com, Mar 1, 2007.

  1. Guest

    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();
    }
     
    , Mar 1, 2007
    #1
    1. Advertising

  2. On Mar 2, 8:16 am, 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.
     
    Andrew Thompson, Mar 2, 2007
    #2
    1. Advertising

  3. Guest

    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.


    On Mar 1, 11:54 pm, "Andrew Thompson" <> wrote:
    >
    > 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.
     
    , Mar 2, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    6
    Views:
    534
    Brendan Reynolds
    Jun 30, 2005
  2. Dan Bishop
    Replies:
    0
    Views:
    237
    Dan Bishop
    Aug 26, 2008
  3. Replies:
    4
    Views:
    271
    Randy Webb
    Dec 14, 2004
  4. Mahsha

    Clipboard - Copy Image To Clipboard

    Mahsha, Jun 1, 2009, in forum: Javascript
    Replies:
    1
    Views:
    588
    Thomas 'PointedEars' Lahn
    Jun 1, 2009
  5. Mahsha

    Clipboard - Copy Text To Clipboard

    Mahsha, Jun 1, 2009, in forum: Javascript
    Replies:
    3
    Views:
    655
    Thomas 'PointedEars' Lahn
    Jun 1, 2009
Loading...

Share This Page