Java Desktop.isDesktopSupported()
Syntax
Desktop.isDesktopSupported() has the following syntax.
public static boolean isDesktopSupported()
Example
In the following code shows how to use Desktop.isDesktopSupported() method.
import java.awt.Desktop;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
//from w ww . j a v a 2 s .c o m
public class Main {
public static void main(String[] a) {
try {
URI uri = new URI("http://www.java2s.com");
Desktop desktop = null;
if (Desktop.isDesktopSupported()) {
desktop = Desktop.getDesktop();
}
if (desktop != null)
desktop.browse(uri);
} catch (IOException ioe) {
ioe.printStackTrace();
} catch (URISyntaxException use) {
use.printStackTrace();
}
}
}
Home »
Java Tutorial »
java.awt »
Java Tutorial »
java.awt »