1

I try to create a button that copy in the clipboard a String and then user can paste it.

I can do it when I do my test in local, but when I deploy the application on a server, nothing is saved in clipboard after an user click on button.

Here's my code :

public void clipboard() {
        try {
            StringSelection stringSelection = new StringSelection("test");
            Clipboard clpbrd = Toolkit.getDefaultToolkit().getSystemClipboard();
            clpbrd.setContents(stringSelection, null);
        } catch (Throwable e) {
            e.printStackTrace();
        }
    }

How can I do it ?

JGeo
  • 380
  • 13
  • 33

0 Answers0