List of usage examples for java.awt.datatransfer Clipboard Clipboard
public Clipboard(String name)
From source file:Main.java
public Main() { Clipboard myClipboard = new Clipboard("name"); // Implement Copy operation StringSelection contents = new StringSelection("data"); clipboard.setContents(contents, this); // Implement Paste operation Transferable content = clipboard.getContents(this); String dstData;//from ww w. java 2s. c o m try { dstData = (String) content.getTransferData(DataFlavor.stringFlavor); System.out.println(clipboard.getData(DataFlavor.stringFlavor)); System.out.println(dstData); } catch (Exception e) { e.printStackTrace(); } }
From source file:net.sf.nmedit.nomad.core.Nomad.java
void setupUI() { this.clipBoard = new Clipboard("nomad clipboard"); ApplicationClipboard.setApplicationClipboard(clipBoard); mainWindow.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); mainWindow.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { Nomad.sharedInstance().handleExit(); }//w w w . ja v a 2s . c o m }); pageContainer = new DefaultDocumentManager(); Container contentPane = mainWindow.getContentPane(); explorerTree = new FileExplorerTree(); explorerTree.setFont(new Font("Arial", Font.PLAIN, 11)); explorerTree.createPopup(menuBuilder); JScrollPane explorerTreeScroller = new JScrollPane(explorerTree); toolPane = new JTabbedPane2(); toolPane.setCloseActionEnabled(false); toolPane.addTab("Explorer", getImage("/icons/eview16/filenav_nav.gif"), explorerTreeScroller); new DropTarget(contentPane, new URIListDropHandler() { public void uriListDropped(URI[] uriList) { for (URI uri : uriList) { try { File f = new File(uri); openOrSelect(f); } catch (IllegalArgumentException e) { // ignore } } } }); synthPane = new JTabbedPane2(); synthPane.setCloseActionEnabled(true); JSplitPane sidebarSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, false); sidebarSplit.setTopComponent(toolPane); sidebarSplit.setBottomComponent(synthPane); sidebarSplit.setResizeWeight(0.8); sidebarSplit.setOneTouchExpandable(true); /* JComponent sidebar = new JPanel(new BorderLayout()); sidebar.setBorder(null); sidebar.add(sidebarSplit, BorderLayout.CENTER); */ if (!Platform.isFlavor(OS.MacOSFlavor)) { /* JToolBar tb = createQuickActionToolbar(); sidebar.add(tb, BorderLayout.NORTH);*/ } else { registerForMacOSXEvents(); } JSplitPane splitLR = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); splitLR.setResizeWeight(0); splitLR.setDividerLocation(200); splitLR.setRightComponent(pageContainer); splitLR.setLeftComponent(sidebarSplit); contentPane.setLayout(new BorderLayout()); contentPane.add(splitLR, BorderLayout.CENTER); if (contentPane instanceof JComponent) ((JComponent) contentPane).revalidate(); }
From source file:org.pentaho.reporting.designer.core.util.dnd.ClipboardManager.java
private ClipboardManager() { this.listeners = new EventListenerList(); try {//from w w w .j av a 2 s. c om this.clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); } catch (final SecurityException se) { logger.error("Failed to create clipboard", se); // NON-NLS this.clipboard = new Clipboard("local-clipboard"); // NON-NLS } }
From source file:org.wings.session.Session.java
public Clipboard getClipboard() { if (this.clipboard == null) this.clipboard = new Clipboard("wingS Clipboard"); return this.clipboard; }