Last active
May 26, 2016 05:37
-
-
Save sifue/24949b080df3beeb868a32644a723b23 to your computer and use it in GitHub Desktop.
ScalaでJavaFXのHello Worldのテンプレート ref: http://qiita.com/sifue/items/ecd667459518e3ca6ae1
This file contains hidden or 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
| import javafx.application.Application | |
| import javafx.event.{ActionEvent, EventHandler} | |
| import javafx.scene.Scene | |
| import javafx.scene.control.Button | |
| import javafx.scene.layout.StackPane | |
| import javafx.stage.Stage | |
| object Main extends App { | |
| Application.launch(classOf[Main], args: _*) | |
| } | |
| class Main extends Application { | |
| override def start(primaryStage: Stage): Unit = { | |
| val btn = new Button() | |
| btn.setText("Say 'Hello World'") | |
| btn.setOnAction(new EventHandler[ActionEvent] { | |
| override def handle(event: ActionEvent): Unit = { | |
| println("Hello") | |
| } | |
| }) | |
| val root = new StackPane() | |
| root.getChildren.add(btn) | |
| val scene = new Scene(root, 300, 250) | |
| primaryStage.setTitle("Hello World!!") | |
| primaryStage.setScene(scene) | |
| primaryStage.show() | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment