Is there a function in JavaFX that allows you to click a hyperlink and have it open in a Browser such as Chrome or Firefox?

MinnesootaBoy :

This is what I have so far, but I am struggling with the handle.

    @FXML
    public void link() {
        hypTerms.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                ;
            }
        });
    }
adxl :

This should work :

Hyperlink link = new Hyperlink("Click me");
String url = "https://www.google.com/";
link.setOnAction(a->getHostServices().showDocument(url));

It will automatically open the page in your default browser.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=317868&siteId=1