JavaFX Undecorated StageStyle将使Windows任务栏保持可见

时间:2019-01-14 21:14:00

标签: java javafx kotlin

嗨,我正在制作JavaFX UI,并且希望它是未修饰的,但是,当我运行该程序时,它将使我的Windows任务栏保持可见状态,是否可以解决此问题?

class MagicBar: Application()
{

override fun start(primaryStage: Stage?)
{
    stage = Stage()
    val fxmlLoader = FXMLLoader()
    val root = fxmlLoader.load<Parent>(javaClass.getResource("/MagicBar.fxml").openStream())
    controller = fxmlLoader.getController<MagicBarController>() as MagicBarController
    stage.initStyle(StageStyle.UNDECORATED)
    val scene = Scene(root, 600.0, 80.0)
    stage.initStyle(StageStyle.TRANSPARENT)
    scene.fill = Color.TRANSPARENT
    stage.scene = scene
    stage.isAlwaysOnTop = true
    stage.show()
}

}

0 个答案:

没有答案