Skip to content

Instantly share code, notes, and snippets.

@akouryy
Created June 21, 2015 15:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akouryy/dc3533601ccdb982bd75 to your computer and use it in GitHub Desktop.
Save akouryy/dc3533601ccdb982bd75 to your computer and use it in GitHub Desktop.
package udon
import scalafx.Includes._
import scalafx.application.JFXApp
import scalafx.application.JFXApp.PrimaryStage
import scalafx.geometry.Insets
import scalafx.scene.Scene
import scalafx.scene.effect.DropShadow
import scalafx.scene.layout.HBox
import scalafx.scene.paint.Color
import scalafx.scene.paint.{LinearGradient, Stops}
import scalafx.scene.text.Text
object ScalaFXHelloWorld extends JFXApp {
stage = new PrimaryStage {
title = "udon"
scene = new Scene {
fill = Color.web("#F9D1D3")
content = new HBox {
padding = Insets(20)
style = "-fx-font-size: 100pt"
effect = new DropShadow {
color = Color.web("#fff9f9")
radius = 25
spread = 0.25
}
def title_text(s: String) = new Text {
text = s
/*fill = new LinearGradient(
endX = 0,
stops = Stops(...)
)*/
fill <== when(hover) choose Color.web("#FFFFFF") otherwise Color.web("#753329")
stroke <== when(hover) choose Color.web("#753329") otherwise Color.web("#00000000")
strokeWidth = 5
padding = Insets(10)
}
children = Seq(
title_text("U"), title_text("D"), title_text("O"), title_text("N")
)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment