Skip to content

Instantly share code, notes, and snippets.

@aki017
Created December 16, 2013 05:01
Show Gist options
  • Save aki017/7982545 to your computer and use it in GitHub Desktop.
Save aki017/7982545 to your computer and use it in GitHub Desktop.
package info.aki017.Test;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Hyperlink;
import javafx.scene.control.Label;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.stage.Stage;
public class Test extends Application {
@Override
public void start(Stage stage) {
BorderPane root = new BorderPane();
HBox hbox = new HBox();
root.setTop(hbox);
Label label1 = new Label("before text");
Hyperlink link = new Hyperlink("http://google.co.jp/");
Label label2 = new Label("after text");
hbox.getChildren().addAll(label1, link, label2);
link.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
getHostServices().showDocument("http://google.co.jp/");
}
});
stage.setScene(new Scene(root, 300, 100));
stage.show();
}
public static void main(String... args) {
launch(args);
}
}
@aki017
Copy link
Author

aki017 commented Dec 16, 2013

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment