In my application I need to display a warning/info message, but I don't know a simple way to do that because there is no JOptionPane or similar component on JavaFX.
There is a Popup class, but you have to set many parameters to get a decent layout/position/background color/etc for a simple message... So I want to know if there is a simple, already implemented component to display messages, maybe in a third party library if JavaFX does not offer anything decent.
Thanks in advance for any help/hints.
Small improvement of ceklock answer
added:
-can't dimiss by click
-auto hide
-change popup position to bottom of window
-you dont have to looking for stage in file, you can pass any control view (button, label, container or what do you want)
JUST CALL:
css:
ControlsFX is JavaFX 8 so I can't use it, and the other alternatives are almost the same level of complexity of what I was going to do. So I implemented my own methods to display an info/warning message using a Popup.
Here is the source code of what I implemented. Just some tweaks to show the Popup centered on the window, use CSS and hide when the user clicks on it.
CSS:
The pop-up message:
With Java 8u40 and upwards, you don't need to worry. It has JavaFX Dialogs.
Here is a Link to Learn: http://code.makery.ch/blog/javafx-dialogs-official/
Just as simple as:
Use a ControlsFX dialog or notification pane.
See also How to create and show common dialog (Error, Warning, Confirmation) in JavaFX 2.0?