Display a message on the screen

前端 未结 3 495
说谎
说谎 2021-01-17 08:48

I would like to display a message onto the screen upon the button press. The message should not have any window and should be displayed at the center of the screen over any

3条回答
  •  旧巷少年郎
    2021-01-17 09:17

    You could create an HBox and center it with a transparent background color (-fx-background-color: transparent;) and in your initialize function, hide it. On a button press, you can show it and either give it a timer and hide it at the end of the timer, or put a small "x" in the top right or bottom, or wherever, with a setOnAction(event -> { myText.hide() }) kind of thing. Just a thought that maybe this got too complicated when all you wanted to do was display some text.

提交回复
热议问题