Last active
May 22, 2017 06:06
-
-
Save patorash/5779631 to your computer and use it in GitHub Desktop.
KotlinでJavaFXのHello Worldをするまで。
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
package sample | |
class Controller { | |
} |
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
package sample | |
import javafx.application.Application | |
import javafx.fxml.FXMLLoader | |
import javafx.scene.Parent | |
import javafx.scene.Scene | |
import javafx.stage.Stage | |
import sun.launcher.resources.launcher | |
class Main() : Application() { | |
public override fun start(primaryStage : Stage?) { | |
val root : Parent? = FXMLLoader.load(getClass().getResource("sample.fxml")) | |
primaryStage!!.setTitle("Hello World") | |
//primaryStage.setScene(Scene(root)) | |
primaryStage.setScene(Scene(root, 300.toDouble(), 275.toDouble())) | |
primaryStage.show(); | |
} | |
} | |
fun main(args : Array<String>) { | |
Application.launch(javaClass<Main>(), args.makeString(" ")) | |
} |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<?import java.lang.*?> | |
<?import javafx.geometry.Insets?> | |
<?import javafx.scene.control.*?> | |
<?import javafx.scene.control.Button?> | |
<?import javafx.scene.control.Label?> | |
<?import javafx.scene.layout.*?> | |
<?import javafx.scene.layout.AnchorPane?> | |
<?import javafx.scene.layout.GridPane?> | |
<?import javafx.scene.text.*?> | |
<AnchorPane prefHeight="40.0" prefWidth="125.0" xmlns:fx="http://javafx.com/fxml"> | |
<children> | |
<Label text="Hello, World!"> | |
<font> | |
<Font size="20.0" /> | |
</font> | |
</Label> | |
</children> | |
</AnchorPane> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment