Saturday, November 8, 2014

List and check ConditionalFeature

javafx.application.ConditionalFeature defines a set of conditional (optional) features. These features may not be available on all platforms. An application that wants to know whether a particular feature is available may query this using the Platform.isSupported() function. Using a conditional feature on a platform that does not support it will not cause an exception. In general, the conditional feature will just be ignored. See the documentation for each feature for more detail.

package javaconditionalfeature;

import javafx.application.ConditionalFeature;
import javafx.application.Platform;

public class JavaConditionalFeature {


    public static void main(String[] args) {
        for (ConditionalFeature c : ConditionalFeature.values()){
            System.out.print(c + " : ");
            if(Platform.isSupported(c)){
                System.out.println("supported");
            }else{
                System.out.println("not supported");
            }
        }
    }    
}

No comments:

Post a Comment