--- old/modules/javafx.controls/src/main/java/javafx/scene/control/Dialog.java 2018-04-07 06:50:16.329622900 +0300 +++ new/modules/javafx.controls/src/main/java/javafx/scene/control/Dialog.java 2018-04-07 06:50:15.928974600 +0300 @@ -101,11 +101,12 @@ * on if the {@link DialogPane#createButton(ButtonType)} method has been overridden. A * typical approach is therefore along the following lines: * - *
{@code ButtonType loginButtonType = new ButtonType("Login", ButtonData.OK_DONE);
- * Dialog dialog = new Dialog<>();
- * dialog.getDialogPane().getButtonTypes().add(loginButtonType);
- * boolean disabled = false; // computed based on content of text fields, for example
- * dialog.getDialogPane().lookupButton(loginButtonType).setDisable(disabled);}
+ *
{@code
+ *     ButtonType loginButtonType = new ButtonType("Login", ButtonData.OK_DONE);
+ *     Dialog dialog = new Dialog<>();
+ *     dialog.getDialogPane().getButtonTypes().add(loginButtonType);
+ *     boolean disabled = false; // computed based on content of text fields, for example
+ *     dialog.getDialogPane().lookupButton(loginButtonType).setDisable(disabled);}
* *

Once a Dialog is instantiated and fully configured, the next step is to * show it. More often than not, dialogs are shown in a modal and blocking @@ -125,20 +126,23 @@ * equally valid ways of showing a dialog: * *

Option 1: The 'traditional' approach - *

{@code Optional result = dialog.showAndWait();
+ * 
{@code
+ * Optional result = dialog.showAndWait();
  * if (result.isPresent() && result.get() == ButtonType.OK) {
  *     formatSystem();
  * }}
* *

Option 2: The traditional + Optional approach - *

{@code dialog.showAndWait().ifPresent(response -> {
+ * 
{@code
+ * dialog.showAndWait().ifPresent(response -> {
  *     if (response == ButtonType.OK) {
  *         formatSystem();
  *     }
  * });}
* *

Option 3: The fully lambda approach - *

{@code dialog.showAndWait()
+ * 
{@code
+ * dialog.showAndWait()
  *      .filter(response -> response == ButtonType.OK)
  *      .ifPresent(response -> formatSystem());}
* @@ -1008,7 +1012,7 @@ // This code is called both in the normal and in the abnormal case (i.e. // both when a button is clicked and when the user forces a window closed - // with keyboard OS-specific shortchuts or OS-native titlebar buttons). + // with keyboard OS-specific shortcuts or OS-native titlebar buttons). @SuppressWarnings("unchecked") void setResultAndClose(ButtonType cmd, boolean close) { Callback resultConverter = getResultConverter();