How do I create and show common dialogs (Error, Warning, Confirmation) in JavaFX 2.0? I can't find any "standard" classes like Dialog
, DialogBox
, Message
or something.
相关问题
- How to properly use Weld in JavaFX 2 application?
- JavaFX, MediaPlayer - volume trouble! Why the volu
- Android: Progress Dialog change ProgressDialog.set
- JavaFX 2 ComboBox setValue() does not set CB text
- How to enable HTML5 local storage in javafx WebVie
相关文章
- Checking & Unchecking Checkboxes inside a JQuery M
- How to show appropriate icon on dialog box
- What are event and UI parameters in Dialog
- Open file from windows file dialog with python aut
- Android - getting an error “no application can per
- How to change the color of pane in javafx?
- Android 4.1.2 dialogs are called twice
- TableView has more columns than specified
Update
Official standard dialogs are coming to JavaFX in release 8u40, as part of the implemenation of RT-12643. These should be available in final release form around March of 2015 and in source code form in the JavaFX development repository now.
In the meantime, you can use the ControlsFX solution below...
ControlsFX is the defacto standard 3rd party library for common dialog support in JavaFX (error, warning, confirmation, etc).
There are numerous other 3rd party libraries available which provide common dialog support as pointed out in some other answers and you can create your own dialogs easily enough using the sample code in Sergey's answer.
However, I believe that ControlsFX easily provide the best quality standard JavaFX dialogs available at the moment. Here are some samples from the ControlsFX documentation.
You can give dialog box which given by the JavaFX UI Controls Project. I think it will help you
Recently released JDK 1.8.0_40 added support for JavaFX dialogs, alerts, etc. For example, to show a confirmation dialog, one would use the Alert class:
Here's a list of added classes in this release:
This working since java 8u40:
EDIT: dialog support was added to JavaFX, see https://stackoverflow.com/a/28887273/1054140
There were no common dialog support in a year 2011. You had to write it yourself by creating new
Stage()
:Sergey is correct, but if you need to get a response from your home-spun dialog(s) for evaluation in the same block of code that invoked it, you should use .showAndWait(), not .show(). Here's my rendition of a couple of the dialog types that are provided in Swing's OptionPane:
}