-
-
Save aki017/7982545 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
} |
Author
aki017
commented
Dec 16, 2013
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment