Package java.awt.datatransfer

Examples of java.awt.datatransfer.Clipboard


            // HACK: getSystemClipboard sometimes deadlocks on
            // linux when called from the AWT Thread. The Thread
            // creation prevents that.
            new Thread() {
                public void run() {
                    Clipboard cb;
                    cb = Toolkit.getDefaultToolkit().getSystemClipboard();
                    StringSelection sel;
                    sel = new StringSelection(strSel);
                    cb.setContents(sel, sel);
                }
            }.start();
        }
View Full Code Here


      JButton button = new JButton("Copy bug report link to clipboard");
      button.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent event) {
              Toolkit tk = getToolkit();
              Clipboard cb = tk.getSystemClipboard();
              cb.setContents(new StringSelection("http://logging.apache.org/site/bugreport.html"), null);
              }});
              panel.add(info, c);

    JLabel title = new JLabel(ChainsawIcons.ICON_LOG4J);
    c.gridy = 1;
View Full Code Here

      if(null == _dialog.txtCommand.getText())
      {
         return;
      }

      Clipboard clip = Toolkit.getDefaultToolkit().getSystemClipboard();
      StringSelection data = new StringSelection(_dialog.txtCommand.getText().trim());
      clip.setContents(data, data);
   }
View Full Code Here

   */
  public void copy()
  {
    if( selectionStart != selectionEnd )
    {
      Clipboard clipboard = getToolkit().getSystemClipboard();

      String selection = getSelectedText();

      int repeatCount = inputHandler.getRepeatCount();
      StringBuffer buf = new StringBuffer();
      for( int i = 0; i < repeatCount; i++ )
        buf.append( selection );

      clipboard.setContents( new StringSelection( buf.toString() ), null );
    }
  }
View Full Code Here

   */
  public void paste()
  {
    if( editable )
    {
      Clipboard clipboard = getToolkit().getSystemClipboard();
      try
      {
        // The MacOS MRJ doesn't convert \r to \n,
        // so do it here
        String selection = ( ( String )clipboard.getContents( this ).getTransferData( DataFlavor.stringFlavor ) )
            .replace( '\r', '\n' );

        int repeatCount = inputHandler.getRepeatCount();
        StringBuffer buf = new StringBuffer();
        for( int i = 0; i < repeatCount; i++ )
View Full Code Here

      super( "Copy to clipboard" );
    }

    public void actionPerformed( ActionEvent e )
    {
      Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();

      StringBuffer buf = new StringBuffer();
      int[] selectedIndices = logList.getSelectedIndices();
      if( selectedIndices.length == 0 )
      {
        for( int c = 0; c < logList.getModel().getSize(); c++ )
        {
          buf.append( logList.getModel().getElementAt( c ).toString() );
          buf.append( "\r\n" );
        }
      }
      else
      {
        for( int c = 0; c < selectedIndices.length; c++ )
        {
          buf.append( logList.getModel().getElementAt( selectedIndices[c] ).toString() );
          buf.append( "\r\n" );
        }
      }

      StringSelection selection = new StringSelection( buf.toString() );
      clipboard.setContents( selection, selection );
    }
View Full Code Here

          contents[r - r0][c - c0] = t.getOutputEntry(r, c - inputs).getDescription();
        }
      }
    }
   
    Clipboard clip = table.getToolkit().getSystemClipboard();
    clip.setContents(new Data(header, contents), this);
  }
View Full Code Here

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

      result.append(prgResult);
      i++;
    }

    if (!parser.showErrors(UiUtilities.getLastModalChildOf(getParentFrame()))) {
      Clipboard clip = java.awt.Toolkit.getDefaultToolkit().getSystemClipboard();
      clip.setContents(new StringSelection(result.toString()), null);
    }
  }
View Full Code Here

    }

    String getClipboardString(final JTextComponent jtc) {
        String content = null;
        Toolkit toolkit = jtc.getToolkit();
        Clipboard clipboard = toolkit.getSystemClipboard();
        DataFlavor dataFlavor = DataFlavor.stringFlavor;
        try {
            content = (String) clipboard.getContents(null).getTransferData(dataFlavor);
        } catch (UnsupportedFlavorException e) {
        } catch (IOException e) {
        }
        return content;
    }
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.