Java Swing Tutorial - Java Toolkit.getSystemClipboard()








Syntax

Toolkit.getSystemClipboard() has the following syntax.

public abstract Clipboard getSystemClipboard()     throws HeadlessException

Example

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.