Results 1 to 5 of 5

Thread: Get the PRIMARY using Java

  1. #1
    Join Date
    Jul 2011
    Beans
    3

    Get the PRIMARY using Java

    Hey guys, my first thread here,

    As some of you know the X11 has something called PRIMARY, SECONDARY and the CLIPBOARD. It's easy to access the clipboard, for instance through java.awt.datatransfer.Clipboard, but do you guys know any way to get the current PRIMARY by some Java API?

  2. #2
    Join Date
    Oct 2011
    Location
    Chicago, IL
    Beans
    419
    Distro
    Xubuntu 10.04 Lucid Lynx

    Re: Get the PRIMARY using Java

    Welcome

    I'm not sure if you're looking for a more system-level solution, but if you are looking to read/copy primary selections from a single program, JTextComponent has a getSelectedText() method.

  3. #3
    Join Date
    Jul 2011
    Beans
    3

    Re: Get the PRIMARY using Java

    Thanks for the reply. I thought maybe there would be an easy way (method or something) to get to the PRIMARY. What I did (which is an ugly solution) was I changed the program autocutsel to make it write to a .txt file. Then I used java to read back from that file.

    If someone has a better solution, I would be delight.

  4. #4
    Join Date
    Oct 2011
    Location
    Chicago, IL
    Beans
    419
    Distro
    Xubuntu 10.04 Lucid Lynx

    Re: Get the PRIMARY using Java

    You could try using JNI to access the native xlib library.

  5. #5
    Join Date
    Jul 2011
    Beans
    3

    Re: Get the PRIMARY using Java

    Thanks ! Eventually, that became my solution.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •