List of usage examples for java.applet AppletContext showDocument
void showDocument(URL url);
From source file:biomine.bmvis2.Vis.java
public void setClipboard(String str) { assert str != null : "Null str"; AppletContext appletContext = null; try {//from w ww .java 2 s . c om appletContext = getAppletContext(); } catch (Exception e) { } Clipboard clipboard; StringSelection data = new StringSelection(str); try { clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); if (clipboard != null) { clipboard.setContents(data, null); } } catch (java.security.AccessControlException e) { if (appletContext != null) { try { str = str.replace('\'', '"'); appletContext .showDocument(new URL("javascript:copyToClipboard(encodeURIComponent('" + str + "'))")); } catch (Exception e2) { JOptionPane.showMessageDialog(null, e2.getMessage(), "Copying to clipboard failed", JOptionPane.ERROR_MESSAGE); } } } catch (Exception e) { JOptionPane.showMessageDialog(null, e.getMessage(), "Copying to clipboard failed", JOptionPane.ERROR_MESSAGE); } }