import
javafx.application.Application;
import
javafx.scene.Scene;
import
javafx.scene.control.*;
import
javafx.scene.layout.*;
import
javafx.stage.Stage;
import
javafx.event.ActionEvent;
import
javafx.event.EventHandler;
import
java.io.*;
import
javafx.scene.image.*;
public
class
hyperlink_1
extends
Application {
public
void
start(Stage stage)
{
try
{
stage.setTitle(
"creating hyperlinks"
);
FileInputStream input =
new
FileInputStream(
"f:\\gfg.png"
);
Image image =
new
Image(input);
ImageView imageview =
new
ImageView(image);
Hyperlink hyperlink =
new
Hyperlink(
"GeeksforGeeks"
, imageview);
HBox hbox =
new
HBox();
Label label =
new
Label(
"hyperlink not visited"
);
EventHandler<ActionEvent> event =
new
EventHandler<ActionEvent>() {
public
void
handle(ActionEvent e)
{
label.setText(
"hyperlink visited "
);
}
};
hyperlink.setOnAction(event);
hbox.getChildren().add(hyperlink);
hbox.getChildren().add(label);
Scene scene =
new
Scene(hbox,
200
,
200
);
stage.setScene(scene);
stage.show();
}
catch
(Exception e) {
System.err.println(e.getMessage());
}
}
public
static
void
main(String args[])
{
launch(args);
}
}