Java Swing Tutorial - Java DataFlavor.clone()








Syntax

DataFlavor.clone() has the following syntax.

public Object clone()  throws CloneNotSupportedException

Example

In the following code shows how to use DataFlavor.clone() method.

import java.awt.datatransfer.DataFlavor;
//  w  ww. j  a  v  a  2  s.  c om
public class Main {

  public static void main(String[] args) {

    DataFlavor df = DataFlavor.stringFlavor;

    try {
      System.out.println (df.clone());
    } catch (CloneNotSupportedException e) {
      e.printStackTrace();
    }
  }
}

The code above generates the following result.