Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Clipboard .isDataFlavorAvailable() In Java 1.4

 
Mark Newton
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm being a bit lazy here, I could probably find a solution myself, but I'm on a bit of a deadline, and thought that someone might have been through this and found a solution that they'd be willing to share. Don't spend lots of time thinking about it though (unless you really want to! )

In a nutshell, I've been working on the assumption that I can use JVM version 1.5, but am now needing to go back to 1.4.2. I've made a very few changes, but need to find some equivalent for Clipboard.isDataFlavorAvailable(), which is only since Java 1.5. All the easy equivalents also seem to be since 1.5 - any help/pointers greatly appreciated!
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
isDataFlavorAvailable() is a really very trivial convenience method. It just calls getContents() to get the Transferable, then calls isDataFlavorSupported() on the Transferable. Add a check for null here and there, and that's all she wrote.
 
Mark Newton
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Great - thanks very much, couldn't have asked for a more perfect answer! It's exactly what I was assuming would be the case, but I didn't have to think! Saved me a good 10 minutes... minus posting time, checking for replies, writing this response...

Still, it feels like I got something for nothing, and that's always good
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic