lesson1
This commit is contained in:
@@ -13,13 +13,28 @@
|
||||
* ...
|
||||
*/
|
||||
|
||||
package com.msksbr.jfxLearn.lesson1
|
||||
|
||||
import javafx.application.Application
|
||||
import javafx.scene.Scene
|
||||
import javafx.stage.Stage
|
||||
import javafx.scene.control.Label
|
||||
import javafx.scene.layout.BorderPane
|
||||
|
||||
// 1. create a class that extends javafx.application.application
|
||||
class MainApplication : Application() {
|
||||
// 2. override Application.start
|
||||
override fun start(stage: Stage) {
|
||||
|
||||
// Node
|
||||
val label = Label("i am label")
|
||||
// Parent
|
||||
val pane = BorderPane(label)
|
||||
// Scene
|
||||
val scene = Scene(pane, 300.0, 300.0)
|
||||
|
||||
// 3. bind Scene to Stage
|
||||
stage.scene = scene
|
||||
stage.title = "i am Stage"
|
||||
stage.show()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user