单击按钮时,我希望应用程序打开一个 URL。所以我这样做:
Desktop desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null;
System.out.println("Hey "+desktop);
if (desktop != null && desktop.isSupported(Desktop.Action.BROWSE)) {
try {
desktop.browse(new URL("http://support.apple.com/kb/DL1572").toURI());
System.out.println("here");
} catch (Exception e) {
e.printStackTrace();
}
}
但Desktop.isDesktopSupported()
返回假。我在 Mac OS X 10.7.5 上。有什么选择吗?