scala-exercises/ScalaFXHello.scala

24 lines
542 B
Scala
Raw Normal View History

2016-11-29 19:36:24 +01:00
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
}
}
}
}