fun main(args: Array) { launch(args) } class ModalTransparencyTest: App(TestView::class, ModalTransparencyStyles::class) class TestView : View() { override val root = vbox { alignment = Pos.CENTER prefHeight = 600.0 prefWidth = 800.0 button("open modal window").action { find().openWindow(StageStyle.TRANSPARENT, escapeClosesWindow = true) } } } class ModalTransparencyStyles : Stylesheet() { companion object { val container by cssclass() val glassBackground by cssclass() val mainWindow by cssclass() val popupWindow by cssclass() } init { mainWindow { backgroundColor += BLUE } popupWindow { backgroundColor += TRANSPARENT } glassBackground { backgroundColor += BLACK opacity = 0.5 } container { backgroundColor += TRANSPARENT } } } class TestFragment: Fragment() { override val root = stackpane { addClass( ModalTransparencyStyles.popupWindow ) vbox { addClass( ModalTransparencyStyles.glassBackground ) vgrow = Priority.ALWAYS } vbox { addClass( ModalTransparencyStyles.container ) alignment = Pos.CENTER vgrow = Priority.ALWAYS label("Label text here") button("Run") } prefWidth = 320.0 prefHeight = 480.0 } override fun onDock() { currentStage!!.scene.fill = Color.TRANSPARENT } }