Have got a Hyperlink. When clicked I want a link to be opened in an external browser.
The usual method cited on the web seems to be:
final Hyperlink
Another way would be to use java.awt.Desktop
Try (untested):
URI uri = ...;
if (Desktop.isDesktopSupported()){
Desktop desktop = Desktop.getDesktop();
if (desktop.isSupported(Desktop.Action.BROWSE)){
desktop.browse(uri);
}
}
Note however that this will introduce a dependency to the AWT stack. This is probably not an issue if you're working with the full JRE, but it might become an issue if you want to work with a tailored JRE (Java SE 9 & Jigsaw) or if you want to run your application on mobile device (javafxports).
There is an open issue to support Desktop in JavaFX in the future.