• Post Reply Bookmark Topic Watch Topic
  • New Topic

getting image from clipboard using java 1.3.1  RSS feed

Sainath Veepuri
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

/* Below is the excerpt I found from www.javaalmanac.com */

// If an image is on the system clipboard, this method returns it;
// otherwise it returns null.
public static Image getClipboard() {
Transferable t = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null);

try {
if (t != null && t.isDataFlavorSupported(DataFlavor.imageFlavor)) {
Image text = (Image)t.getTransferData(DataFlavor.imageFlavor);
return text;
} catch (UnsupportedFlavorException e) {
} catch (IOException e) {
return null;

The above code works absolutely fine while using java 1.4.1
But it doesnot work on java 1.3.1 as DataFlavor.imageFlavor is not present in that version. Is there a way to get an image from the clipboard in java 1.3.1 version.
Would any one throw some light in the dark.
Thank You,
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!