Package java.awt.datatransfer

Examples of java.awt.datatransfer.Clipboard


  /**
   * copies the content of the selection to the clipboard
   */
  public void copyContent() {
    StringSelection      selection;
    Clipboard            clipboard;
   
    selection = getTable().getStringSelection();
    if (selection == null)
      return;
   
    clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
    clipboard.setContents(selection, selection);
  }
View Full Code Here


    HexModel model = editor.getModel();
    for (long i = p0; i < p1; i++) {
      data[(int) (i - p0)] = model.get(i);
    }
   
    Clipboard clip = editor.getToolkit().getSystemClipboard();
    clip.setContents(new Data(data), this);
  }
View Full Code Here

    Clipboard clip = editor.getToolkit().getSystemClipboard();
    clip.setContents(new Data(data), this);
  }
 
  public boolean canPaste() {
    Clipboard clip = editor.getToolkit().getSystemClipboard();
    Transferable xfer = clip.getContents(this);
    return xfer.isDataFlavorSupported(binaryFlavor);
  }
View Full Code Here

    Transferable xfer = clip.getContents(this);
    return xfer.isDataFlavorSupported(binaryFlavor);
  }
 
  public void paste() {
    Clipboard clip = editor.getToolkit().getSystemClipboard();
    Transferable xfer = clip.getContents(this);
    int[] data;
    if (xfer.isDataFlavorSupported(binaryFlavor)) {
      try {
        data = (int[]) xfer.getTransferData(binaryFlavor);
      } catch (UnsupportedFlavorException e) {
View Full Code Here

        }
        buffer.append('\n');
      }
    }
    final StringSelection ss = new StringSelection(buffer.toString());
    final Clipboard cb = Toolkit.getDefaultToolkit().getSystemClipboard();
    cb.setContents(ss, ss);

  }
View Full Code Here

      buf.append(name).append(", ");
    }
    if (buf.length() > 0)
    {
      buf.setLength(buf.length() - 2)// Remove trailing ", ".
      Clipboard clip = Toolkit.getDefaultToolkit().getSystemClipboard();
      StringSelection data = new StringSelection(buf.toString());
      clip.setContents(data, data);
    }
  }
View Full Code Here

        buf.append("</tr>\n");
      }
      buf.append("</table>");

            htmlSelection.setData(buf.toString());
            Clipboard cb = Toolkit.getDefaultToolkit().getSystemClipboard();
        cb.setContents(htmlSelection, null);
    }
  }
View Full Code Here

   * owner of the Clipboard's contents.
   */
  public void setClipboardContents( String aString )
  {
    StringSelection stringSelection = new StringSelection( aString ) ;
    Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard() ;
    clipboard.setContents( stringSelection, this ) ;
  }
View Full Code Here

   * empty String.
   */
  public String getClipboardContents()
  {
    String result = "" ;
    Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard() ;
    //odd: the Object param of getContents is not currently used
    Transferable contents = clipboard.getContents( null ) ;
    if ( ( contents != null ) &&
        contents.isDataFlavorSupported( DataFlavor.stringFlavor ) )
    {
      try
      {
View Full Code Here

  }
 
 
  void setClipboardContents( String str ){
    StringSelection stringSelection = new StringSelection( str );
    Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
    clipboard.setContents( stringSelection, this );
  }
View Full Code Here

TOP

Related Classes of java.awt.datatransfer.Clipboard

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.