content: // ===============================================================================
  // Authors: AFRL/RQQD
  // Organization: Air Force Research Laboratory, Aerospace Systems Directorate, Power and Control Division
  // 
  // Copyright (c) 2017 Government of the United State of America, as represented by
  // the Secretary of the Air Force.  No copyright is claimed in the United States under
  // Title 17, U.S. Code.  All Other Rights Reserved.
  // ===============================================================================
  
  
  
  
  package avtas.swing;
  
  import java.awt.Image;
  import java.awt.datatransfer.DataFlavor;
  import java.awt.datatransfer.Transferable;
  import java.awt.datatransfer.UnsupportedFlavorException;
  import java.io.IOException;
  
  /**
   * Assists in sending an image to the system clipboard
   * @author AFRL/RQQD
   */
  public class ImageSelection implements Transferable{
  
      private final Image image;
  
      public ImageSelection(Image image) {
          this.image = image;
      }
  
      public DataFlavor[] getTransferDataFlavors() {
          return new DataFlavor[] { DataFlavor.imageFlavor};
      }
  
      public boolean isDataFlavorSupported(DataFlavor flavor) {
          return flavor == DataFlavor.imageFlavor;
      }
  
      public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException {
          if (flavor == DataFlavor.imageFlavor) {
              return image;
          }
          return null;
      }
  
  }
  
  /* Distribution A. Approved for public release. 
   *  Case: #88ABW-2015-4601. Date: 24 Sep 2015. */