Java Swing Tutorial - Java Toolkit.getSystemClipboard()


Toolkit.getSystemClipboard() has the following syntax.

public abstract Clipboard getSystemClipboard()     throws HeadlessException


In the following code shows how to use Toolkit.getSystemClipboard() method.

import java.awt.Toolkit;
//from   www  .  jav a2s . co m
public class Main {
  public static void main(String[] args) {
    Toolkit tk = Toolkit.getDefaultToolkit();

    System.out.println("System clipboard = " + tk.getSystemClipboard());


The code above generates the following result.