JavaFX: Hyperlink

This entry is part 48 of 55 in the series JavaFX

When a hyperlink is pressed and released, an ActionEvent is sent.  Only one action could occur and this is to bring out the hyperlink page.

So in the example below, when you click on the hyper link, it will bring out the browser with the page as expected.

package link;

import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Hyperlink;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.stage.Stage;

public class Link extends Application {

    public void start(Stage stage) {
        BorderPane borderPane = new BorderPane();

        HBox hbox = new HBox();

        Hyperlink link = new Hyperlink("");



        link.setOnAction(new EventHandler<ActionEvent>() {
            public void handle(ActionEvent event) {
        stage.setScene(new Scene(borderPane, 300, 200));;

    public static void main(String... args) {


Series Navigation<< JavaFX: Setting absolute position for circle
JavaFX: Putting drawings into group >>

Leave a comment

Leave a Reply