- 热门类别
Data Structure(数据结构)
Networking(网络)
RDBMS(关系数据库管理系统)
Operating System(操作系统)
Java
MS Excel(微软 Excel)
iOS
HTML
CSS
Android
Python
C Programming(C 编程)
C++
C#
MongoDB
MySQL
Javascript(JavaScript)
PHPPhysics(物理学)
Chemistry(化学)
Biology(生物学)
Mathematics(数学)
English(英语)
Economics(经济学)
Psychology(心理学)
Social Studies(社会学)
Fashion Studies(时尚研究)
Legal Studies(法律研究)
如何使用 JavaFX 创建超链接?
超链接是一种 UI 组件,对点击和滚动做出响应。你可以通过实例化 javafx.scene.control.Hyperlink 类 来创建超链接。
示例
以下示例演示了如何创建 **超链接**。
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Hyperlink;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
public class HiperlinkExample extends Application {
public void start(Stage stage) {
//Creating a hyper link
Hyperlink link = new Hyperlink("https://tutorialspoint.com");
//Creating a vbox to hold the pagination
VBox vbox = new VBox();
vbox.setSpacing(5);
vbox.setPadding(new Insets(50, 50, 50, 60));
vbox.getChildren().addAll(link);
//Setting the stage
Group root = new Group(vbox);
Scene scene = new Scene(root, 595, 200, Color.BEIGE);
stage.setTitle("Hyperlink");
stage.setScene(scene);
stage.show();
}
public static void main(String args[]){
launch(args);
}
}
广告