Package java.awt.datatransfer

Examples of java.awt.datatransfer.StringSelection


        });
        JButton copyButton = new JButton("Copy");
        copyButton.setMnemonic('o');
        copyButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                StringSelection trace = new StringSelection(text.getText());
                Clipboard cp = Toolkit.getDefaultToolkit().getSystemClipboard();
                cp.setContents(trace, trace);
            }
        });
        buttonPanel.add(copyButton);
View Full Code Here


    // 1. Create a frame that displays a home view
    JFrame frame = new JFrame("Home TransferHandler Test");   
    frame.add(homeView);
    frame.pack();
    // Ensure clipboard is empty
    Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(""), null);

    // Show home plan frame
    showWindow(frame);
    final JComponentTester tester = new JComponentTester();
    tester.waitForIdle();
View Full Code Here

  public void lostOwnership(Clipboard clipboard, Transferable contents) {
  }


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

  }

  protected void doCopyPath() {
    String path = node.absolutePath();

    StringSelection sel  = new StringSelection(path);
    Clipboard       clip = Toolkit.getDefaultToolkit().getSystemClipboard();
   
    clip.setContents(sel, sel);
  }
View Full Code Here

    {
      Clipboard clippy = Toolkit.getDefaultToolkit().getSystemClipboard();
      //Transferable clippysContent = clippy.getContents( null );
      try{

     Transferable transferableText = new StringSelection(charValue);
         clippy.setContents( transferableText, null  );
       
         //logger.debug("os.name :: "+System.getProperty("os.name"));
      
         if (System.getProperty("os.name").toUpperCase().indexOf("WINDOWS") >= 0) {
View Full Code Here

    {
      Clipboard clippy = Toolkit.getDefaultToolkit().getSystemClipboard();
      //Transferable clippysContent = clippy.getContents( null );
      try{

     Transferable transferableText = new StringSelection(charValue);
         clippy.setContents( transferableText, null  );
       
         //logger.debug("os.name :: "+System.getProperty("os.name"));
      
         if (System.getProperty("os.name").toUpperCase().indexOf("WINDOWS") >= 0) {
View Full Code Here

                    new ExtendedHTMLWriter(plainTextWriter, (HTMLDocument) getDocument(), selStart, selLength).write();
                } catch (Exception e) {
                }

                String plainText = NcrToUnicode.decode(plainTextWriter.toString());
                clip.setContents(new StringSelection(plainText), null);

                if (action == TransferHandler.MOVE) {
                    getDocument().remove(selStart, selLength);
                }
            } catch (BadLocationException ble) {
View Full Code Here

  public void movieToClipboardButton_clicked() {
    try {
      updateMovieFields();
      Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
      String xml = new FlameMovieWriter().getMovieXML(currMovie);
      StringSelection data = new StringSelection(xml);
      clipboard.setContents(data, data);
    }
    catch (Throwable ex) {
      errorHandler.handleError(ex);
    }
View Full Code Here

  public void saveFlameToClipboard() {
    try {
      if (getCurrFlame() != null) {
        Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
        String xml = new FlameWriter().getFlameXML(getCurrFlame());
        StringSelection data = new StringSelection(xml);
        clipboard.setContents(data, data);
        //        try {
        //          System.out.println(new ScriptGenerator(getCurrFlame()).generateScript());
        //        }
        //        catch (Throwable ex) {
View Full Code Here

    final int row = target.getSelectedRow();

    final String link = target.getName().equals("search") ? (String) target
        .getValueAt(row, 3) : (String) target.getValueAt(row, 7);
    ;
    final StringSelection stringSelection = new StringSelection(link);
    final Clipboard clpbrd = Toolkit.getDefaultToolkit()
        .getSystemClipboard();
    clpbrd.setContents(stringSelection, null);
  }
View Full Code Here

TOP

Related Classes of java.awt.datatransfer.StringSelection

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.