Java examples for JavaFX:Dialog
Decorates a JavaFX dialog with window icons.
import java.util.Collection; import javafx.scene.control.Alert; import javafx.scene.control.Alert.AlertType; import javafx.scene.control.Dialog; import javafx.scene.image.Image; import javafx.stage.Stage; import javafx.stage.Window; public class Main{ /**/* w w w .j av a2 s.c o m*/ * Decorates a dialog with window icons. * Note: this may not be required anymore with newer Java versions. * * @param dlg the dialog to decorate */ public static void decorateDialogWithIcon(Dialog<?> dlg) { Window window = dlg.getDialogPane().getScene().getWindow(); if (window instanceof Stage) { Stage stage = (Stage) dlg.getDialogPane().getScene() .getWindow(); Collection<Image> icons = IconUtils.createWindowIcons(); stage.getIcons().addAll(icons); } } }