24 lines
542 B
Scala
24 lines
542 B
Scala
|
import scalafx.Includes._
|
||
|
import scalafx.application.JFXApp
|
||
|
import scalafx.scene.Scene
|
||
|
import scalafx.scene.paint.Color
|
||
|
import scalafx.scene.shape.Rectangle
|
||
|
|
||
|
object ScalaFXHello extends JFXApp {
|
||
|
stage = new JFXApp.PrimaryStage {
|
||
|
title.value = "Hello Stage"
|
||
|
width = 600
|
||
|
height = 450
|
||
|
scene = new Scene {
|
||
|
fill = Color.LightGreen
|
||
|
content = new Rectangle {
|
||
|
x = 25
|
||
|
y = 40
|
||
|
width = 100
|
||
|
height = 100
|
||
|
fill <== when (hover) choose Color.Green otherwise Color.Red
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|