Example usage for javafx.fxml FXMLLoader setResources

List of usage examples for javafx.fxml FXMLLoader setResources

Introduction

In this page you can find the example usage for javafx.fxml FXMLLoader setResources.

Prototype

public void setResources(ResourceBundle resources) 

Source Link

Document

Sets the resources used to resolve resource key attribute values.

Usage

From source file:ninja.javafx.smartcsv.fx.FXMLController.java

protected final void loadFXML() throws IOException {
    try (InputStream fxmlStream = getClass().getResourceAsStream(fxmlFilePath)) {
        FXMLLoader loader = new FXMLLoader();
        loader.setResources(ResourceBundle.getBundle(this.resourcePath));
        loader.setController(this);
        this.view = (loader.load(fxmlStream));
    } catch (Throwable t) {
        t.printStackTrace();//from ww w.j  av  a2 s  .  co m
    }
}

From source file:com.properned.application.SystemController.java

@FXML
public void openHelpDialog() {
    logger.info("Open the help dialog");
    FXMLLoader loader = new FXMLLoader();
    loader.setLocation(getClass().getResource("/com/properned/gui/helpFrame.fxml"));
    loader.setResources(MessageReader.getInstance().getBundle());

    try {//w  w  w. j  av a  2 s.  c om
        loader.load();
        Parent root = loader.getRoot();
        Stage modalDialog = new Stage();
        modalDialog.setTitle(MessageReader.getInstance().getMessage("menu.help.help"));
        modalDialog.setResizable(true);
        modalDialog.getIcons().add(new Image("/com/properned/style/icon/icon_16.png"));

        Scene scene = new Scene(root);
        scene.getStylesheets().add("/com/properned/style/application.css");
        modalDialog.setScene(scene);
        modalDialog.show();
    } catch (IOException e) {
        Properned.getInstance().showError(MessageReader.getInstance().getMessage("error.openFrame"), e);
    }
}

From source file:com.properned.application.SystemController.java

@FXML
public void openAboutDialog() {
    logger.info("Open the about dialog");
    FXMLLoader loader = new FXMLLoader();
    loader.setLocation(getClass().getResource("/com/properned/gui/aboutFrame.fxml"));
    loader.setResources(MessageReader.getInstance().getBundle());

    try {//w ww .  j  a v a 2s . co m
        loader.load();

        Parent root = loader.getRoot();

        Stage modalDialog = new Stage(StageStyle.UTILITY);
        modalDialog.initOwner(Properned.getInstance().getPrimaryStage());
        modalDialog.setTitle(MessageReader.getInstance().getMessage("menu.help.about"));
        modalDialog.setResizable(false);

        Scene scene = new Scene(root);
        scene.getStylesheets().add("/com/properned/style/application.css");

        modalDialog.setScene(scene);

        modalDialog.showAndWait();
    } catch (IOException e) {
        Properned.getInstance().showError(MessageReader.getInstance().getMessage("error.openFrame"), e);
    }
}

From source file:com.properned.application.SystemController.java

@FXML
public void openLocaleDialog() {
    logger.info("Open the locale dialog");

    FXMLLoader loader = new FXMLLoader();
    loader.setLocation(getClass().getResource("/com/properned/gui/localeFrame.fxml"));
    loader.setResources(MessageReader.getInstance().getBundle());

    try {//from   w  w  w .j  a  v  a  2s.  c o  m
        loader.load();

        Parent root = loader.getRoot();

        Stage modalDialog = new Stage(StageStyle.UNIFIED);
        modalDialog.initModality(Modality.APPLICATION_MODAL);
        modalDialog.initOwner(Properned.getInstance().getPrimaryStage());
        modalDialog.setTitle(MessageReader.getInstance().getMessage("manageLocale.title"));
        modalDialog.setResizable(true);
        modalDialog.getIcons().add(new Image("/com/properned/style/icon/icon_16.png"));

        Scene scene = new Scene(root);
        scene.getStylesheets().add("/com/properned/style/application.css");

        modalDialog.setScene(scene);

        modalDialog.showAndWait();
    } catch (IOException e) {
        Properned.getInstance().showError(MessageReader.getInstance().getMessage("error.openFrame"), e);
    }
}