Example usage for javafx.stage Stage getIcons

List of usage examples for javafx.stage Stage getIcons

Introduction

In this page you can find the example usage for javafx.stage Stage getIcons.

Prototype

public final ObservableList<Image> getIcons() 

Source Link

Document

Gets the icon images to be used in the window decorations and when minimized.

Usage

From source file:cz.lbenda.rcp.DialogHelper.java

/** Create dialog with right icons */
public static <T> Dialog<T> createDialog(Object caller, String iconBaseName) {
    Dialog<T> dialog = new Dialog<>();
    Stage stage = (Stage) dialog.getDialogPane().getScene().getWindow();
    if (iconBaseName == null) {
        iconBaseName = MessageFactory.getInstance().getMessage("app.icon");
    }//from w  ww .j a va 2 s  . com
    stage.getIcons().add(IconFactory.getInstance().image(caller, iconBaseName, IconFactory.IconSize.SMALL));
    stage.getIcons().add(IconFactory.getInstance().image(caller, iconBaseName, IconFactory.IconSize.MEDIUM));
    stage.getIcons().add(IconFactory.getInstance().image(caller, iconBaseName, IconFactory.IconSize.LARGE));
    stage.getIcons().add(IconFactory.getInstance().image(caller, iconBaseName, IconFactory.IconSize.XLARGE));
    return dialog;
}

From source file:jlotoprint.MainViewController.java

public static Stage loadTemplateChooser() {
    final Stage stage = new Stage();
    try {/*from   ww  w .j a v a  2 s. com*/
        FXMLLoader dialog = new FXMLLoader(MainViewController.class.getResource("TemplateDialog.fxml"));
        Parent root = (Parent) dialog.load();
        root.addEventHandler(TemplateDialogEvent.CANCELED, (actionEvent) -> {
            stage.close();
        });
        stage.setScene(new Scene(root));
        stage.setTitle("Choose a template");
        stage.getIcons().add(new Image("file:resources/icon.png"));
        stage.initModality(Modality.WINDOW_MODAL);
        stage.initOwner(JLotoPrint.stage.getScene().getWindow());
        stage.show();
    } catch (IOException ex) {
        Logger.getLogger(MainViewController.class.getName()).log(Level.SEVERE, null, ex);
        return null;
    }
    return stage;
}

From source file:org.martus.client.swingui.PureFxMainWindow.java

public static void updateIcon(Stage stage) {
    Image image = getMartusIconImage();
    stage.getIcons().add(image);
}

From source file:com.rcs.shoe.shop.fx.controller.ui.Controller.java

protected void showInformationPopup(String title, String headerText, String contentText) {
    Alert alert = new Alert(Alert.AlertType.INFORMATION);
    alert.setTitle(title);/*ww w.j  a v  a  2  s  .co  m*/
    alert.setHeaderText(headerText);
    alert.setContentText(contentText);

    ButtonType okButton = new ButtonType("Nastavi", ButtonBar.ButtonData.OK_DONE);

    alert.getButtonTypes().setAll(okButton);

    Stage stage = (Stage) alert.getDialogPane().getScene().getWindow();
    stage.getIcons().add(uIConfig.getIcon());

    alert.showAndWait();
}

From source file:com.rcs.shoe.shop.fx.controller.ui.Controller.java

protected boolean showConfirmPopup(String title, String header, String contentText) {
    Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
    alert.setTitle(title);/*from  ww  w .java2  s . co m*/
    alert.setHeaderText(header);
    alert.setContentText(contentText);

    ButtonType okButton = new ButtonType("Da", ButtonBar.ButtonData.OK_DONE);
    ButtonType cancelButton = new ButtonType("Ne", ButtonBar.ButtonData.CANCEL_CLOSE);

    alert.getButtonTypes().setAll(okButton, cancelButton);

    Stage stage = (Stage) alert.getDialogPane().getScene().getWindow();
    stage.getIcons().add(uIConfig.getIcon());

    Optional<ButtonType> result = alert.showAndWait();
    if (result.get().getButtonData() == ButtonBar.ButtonData.OK_DONE) {
        return true;
    }
    return false;
}

From source file:spdxedit.PackageEditor.java

/**
 * Opens the modal package editor for the provided package.
 *
 * @param pkg               The package to edit.
 * @param relatablePackages Packages to which the edited package may optionally have defined relationships
 * @param parentWindow      The parent window.
 *//* www  . jav a2 s. c  o m*/
public static void editPackage(final SpdxPackage pkg, final List<SpdxPackage> relatablePackages,
        SpdxDocumentContainer documentContainer, Window parentWindow) {

    final PackageEditor packageEditor = new PackageEditor(pkg, relatablePackages, documentContainer);
    final Stage dialogStage = new Stage();
    dialogStage.setTitle("Edit SPDX Package: " + pkg.getName());
    dialogStage.initStyle(StageStyle.DECORATED);
    dialogStage.initModality(Modality.APPLICATION_MODAL);
    dialogStage.setY(parentWindow.getX() + parentWindow.getWidth() / 2);
    dialogStage.setY(parentWindow.getY() + parentWindow.getHeight() / 2);
    dialogStage.setResizable(false);
    try {
        FXMLLoader loader = new FXMLLoader(NewPackageDialog.class.getResource("/PackageEditor.fxml"));
        loader.setController(packageEditor);
        Pane pane = loader.load();
        Scene scene = new Scene(pane);
        dialogStage.setScene(scene);
        dialogStage.getIcons().clear();
        dialogStage.getIcons().add(UiUtils.ICON_IMAGE_VIEW.getImage());
        //Populate the file list on appearance
        dialogStage.setOnShown(event -> {
            try {
                final SpdxFile dummyfile = new SpdxFile(pkg.getName(), null, null, null, null, null, null, null,
                        null, null, null, null, null);
                TreeItem<SpdxFile> root = new TreeItem<>(dummyfile);
                packageEditor.filesTable.setRoot(root);
                //Assume a package without is external
                //TODO: replace with external packages or whatever alternate mechanism in 2.1
                packageEditor.btnAddFile.setDisable(pkg.getFiles().length == 0);
                root.getChildren()
                        .setAll(Stream.of(pkg.getFiles())
                                .sorted(Comparator.comparing(file -> StringUtils.lowerCase(file.getName()))) //Sort by file name
                                .map(TreeItem<SpdxFile>::new).collect(Collectors.toList()));
            } catch (InvalidSPDXAnalysisException e) {
                logger.error("Unable to get files for package " + pkg.getName(), e);
            }

            packageEditor.tabFiles.setExpanded(true);

        });

        //Won't assign this event through FXML - don't want to propagate the stage beyond this point.
        packageEditor.btnOk.setOnMouseClicked(event -> dialogStage.close());
        dialogStage.showAndWait();

    } catch (IOException ioe) {
        throw new RuntimeException("Unable to load dialog", ioe);
    }
}

From source file:dtv.DTVEdit.java

@Override
public void start(Stage primaryStage) throws Exception {

    notifyPreloader(new Preloader.StateChangeNotification(Preloader.StateChangeNotification.Type.BEFORE_START));

    primaryStage.setTitle("DTV Edit");
    primaryStage.getIcons().add(new Image(getClass().getResourceAsStream("/app_icon.png")));

    AnchorPane mainView = (AnchorPane) load("/dtv/view/FXMLMain.fxml");

    // Show the scene containing the root layout.
    Scene scene = new Scene(mainView);
    primaryStage.setScene(scene);/*from  w w w .  j ava 2s  . c o m*/
    primaryStage.setResizable(false);
    primaryStage.setOnCloseRequest(e -> Platform.exit());
    // set scss style
    /*
    String css = getClass().getResource("/myStyle.css").toExternalForm();
    scene.getStylesheets().clear();
    scene.getStylesheets().add(css);
    */
    primaryStage.show();
}

From source file:org.pdfsam.PdfsamApp.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setScene(mainScene);//from   w  w w.  jav a2 s .  com
    primaryStage.getIcons().addAll(ApplicationContextHolder.getContext().getBeansOfType(Image.class).values());
    primaryStage.setTitle(ApplicationContextHolder.getContext().getBean(Pdfsam.class).name());

    initWindowsStatusController(primaryStage);
    initOverwriteDialogController(primaryStage);
    initActiveModule();
    primaryStage.show();
    Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionLogger());
    requestCheckForUpdateIfNecessary();
    requestLatestNewsPanelDisplay();
    eventStudio().addAnnotatedListeners(this);
    STOPWATCH.stop();
    LOG.info(DefaultI18nContext.getInstance().i18n("Started in {0}",
            DurationFormatUtils.formatDurationWords(STOPWATCH.getTime(), true, true)));
}

From source file:ninja.eivind.hotsreplayuploader.Client.java

@Override
public void start(final Stage primaryStage) throws Exception {
    try {//from  ww  w.j ava 2  s.c  o  m
        final URL logo = platformService.getLogoUrl();
        final Image image = new Image(logo.toString());
        primaryStage.getIcons().add(image);
        primaryStage.setResizable(false);
        addToTray(primaryStage);
        platformService.setupWindowBehaviour(primaryStage);

        // Set window title
        final String windowTitle = Constants.APPLICATION_NAME + " v" + releaseManager.getCurrentVersion();
        primaryStage.setTitle(windowTitle);

        Scene scene = sceneBuilderFactory.builder()
                .setLocation("/ninja/eivind/hotsreplayuploader/window/Home.fxml").build();

        primaryStage.setScene(scene);
        primaryStage.show();
    } catch (Exception e) {
        LOG.error("Failed to start", e);
        throw e;
    }
}

From source file:com.omicronware.streamlet.Main.java

@Override
public void start(Stage stage) throws Exception {
    //register the different type of lists on ObjectFactory

    stage.setTitle("StreamLET - Omicronware Software (C)");
    stage.getIcons().add(new Image(
            getClass().getResource("/com/omicronware/streamlet/fxml/images/icon_96_96.png").toExternalForm()));
    stage.setOnHidden((WindowEvent event) -> {
        if (DATABASE != null) {
            DATABASE.close();//from w  ww .  jav a  2s  . c  o m
        }
        if (SETTINGS != null) {
            StoreObjectManager.getInstance().storeObject(SETTINGS);
        }
        Platform.exit();
        System.exit(0);
    });
    this.stage = stage;
    openDatabase();
}