Java examples for 2D Graphics:Image
get Clipboard Image
//package com.java2s; import java.awt.Toolkit; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.image.BufferedImage; import javax.swing.JOptionPane; public class Main { public static BufferedImage getClipboardImage() { Transferable t = Toolkit.getDefaultToolkit().getSystemClipboard() .getContents(null);/*from ww w .j av a 2s. c o m*/ try { if (t != null && t.isDataFlavorSupported(DataFlavor.imageFlavor)) { BufferedImage img = (BufferedImage) t .getTransferData(DataFlavor.imageFlavor); return img; } } catch (Exception e) { JOptionPane.showConfirmDialog(null, "Failed:" + e.getMessage()); } return null; } }