File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Clipboard .isDataFlavorAvailable() In Java 1.4 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Clipboard .isDataFlavorAvailable() In Java 1.4" Watch "Clipboard .isDataFlavorAvailable() In Java 1.4" New topic

Clipboard .isDataFlavorAvailable() In Java 1.4

Mark Newton
Ranch Hand

Joined: Jan 31, 2006
Posts: 129

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

Joined: Jul 08, 2003
Posts: 24195

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.

[Jess in Action][AskingGoodQuestions]
Mark Newton
Ranch Hand

Joined: Jan 31, 2006
Posts: 129
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
It is sorta covered in the JavaRanch Style Guide.
subject: Clipboard .isDataFlavorAvailable() In Java 1.4
It's not a secret anymore!