-
Notifications
You must be signed in to change notification settings - Fork 128
Dialogs
Pawel Pastuszak edited this page Dec 7, 2018
·
4 revisions
Dialogs (source) is a utility class for displaying well... dialogs. It can display these types of dialog:
- Standard confirmation dialog with OK button.
- Option dialog with buttons like Yes, No, Cancel
- Error dialog with OK button
- Error dialog with OK button, and Details button Showcase
- Input dialog Screenshot
- Input dialog with validator (see VisValidableTextField)
Dialogs has only static methods.
showOKDialog (Stage stage, String title, String text)
//without details
showErrorDialog (Stage stage, String text)
//with stacktrace as details
showErrorDialog (Stage stage, String text, Exception exception)
//with custom details
showErrorDialog (Stage stage, String text, String details)
//option dialog (return OptionDialog because you may want to change buttons text)
OptionDialog showOptionDialog (Stage stage, String title, String text, OptionDialogType type, final OptionDialogListener listener)
Input dialog examples:
//input dialog
Dialogs.showInputDialog(getStage(), "enter your name", "name: ", new InputDialogAdapter() {
@Override
public void finished (String input) {
Dialogs.showOKDialog(getStage(), "result", "your name is: " + input);
}
});
//input dialog that only allows to enter integer
//see IntegerValidator: https://github.com/kotcrab/vis-ui/blob/master/ui/src/test/java/com/kotcrab/vis/ui/test/IntegerValidator.java
Dialogs.showInputDialog(getStage(), "enter int number", null, new IntegerValidator(), new InputDialogAdapter() {
@Override
public void finished (String input) {
Dialogs.showOKDialog(getStage(), "result", "you entered: " + input);
}
});
See README for VisUI introduction.