JavaFX Tutorial 12 Hyperlink Java GUI
Code Source:
@Override
public void start(Stage primaryStage) {
HBox h = new HBox();
Hyperlink hlink = new Hyperlink("www.youtube.com");
hlink.setOnAction(new EventHandler ActionEvent () {
@Override
public void handle(ActionEvent event) {
JOptionPane.showMessageDialog(null, "Your Link" + hlink.getText());
}
});
Libraries Importing :
import java.util.ArrayList;
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.HBox;
import javafx.stage.Stage;
import javax.swing.JOptionPane;
The JavaFX Hyperlink control is a text that functions as a button, meaning you can configure a Hyperlink to perform some action when the user clicks it. Just like a hyperlink in a web page. The JavaFX Hyperlink control is represented by the class javafx.scene.control.Hyperlink .
h.getChildren().addAll(hlink);
Scene sc = new Scene(h,600,400);
primaryStage.setScene(sc);
primaryStage.setTitle("Tutorial JavaFX");
primaryStage.show();
On this page of the site you can watch the video online JavaFX Tutorial 12 - Hyperlink Java GUI with a duration of online in good quality, which was uploaded by the user Code Amir 05 April 2020, share the link with friends and acquaintances, this video has already been watched 1,558 times on youtube and it was liked by 12 viewers. Enjoy your viewing!