ParaMonte MATLAB 3.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
ImageSelection.java
Go to the documentation of this file.
1/*
2 * Based on code snippet from
3 * http://java.sun.com/developer/technicalArticles/releases/data/
4 *
5 * Copyright © 2008, 2010 Oracle and/or its affiliates. All rights reserved. Use is subject to license terms.
6 */
7
8import java.awt.image.BufferedImage;
9import java.awt.datatransfer.*;
10
11public class ImageSelection implements Transferable {
12
13 private static final DataFlavor flavors[] =
14 {DataFlavor.imageFlavor};
15
16 private BufferedImage image;
17
18 public ImageSelection(BufferedImage image) {
19 this.image = image;
20 }
21
22 // Transferable
23 public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException {
24 if (flavor.equals(flavors[0]) == false) {
25 throw new UnsupportedFlavorException(flavor);
26 }
27 return image;
28 }
29
30 public DataFlavor[] getTransferDataFlavors() {
31 return flavors;
32 }
33
34 public boolean isDataFlavorSupported(DataFlavor
35 flavor) {
36 return flavor.equals(flavors[0]);
37 }
38}
Object getTransferData(DataFlavor flavor)
boolean isDataFlavorSupported(DataFlavor flavor)
ImageSelection(BufferedImage image)
DataFlavor[] getTransferDataFlavors()