当前位置: 首页>>代码示例>>Java>>正文


Java FXMLLoader.setResources方法代码示例

本文整理汇总了Java中javafx.fxml.FXMLLoader.setResources方法的典型用法代码示例。如果您正苦于以下问题:Java FXMLLoader.setResources方法的具体用法?Java FXMLLoader.setResources怎么用?Java FXMLLoader.setResources使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.fxml.FXMLLoader的用法示例。


在下文中一共展示了FXMLLoader.setResources方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: openPackageDetails

import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
public static void openPackageDetails(PackageType pkg, List<CrxPackage> packageList, AuthHandler handler) {
    try {
        FXMLLoader loader = new FXMLLoader(EpicApp.class.getResource("/fxml/PackageInfo.fxml"));
        loader.setResources(ApplicationState.getInstance().getResourceBundle());
        loader.load();
        PackageInfoController runnerActivityController = loader.getController();

        Stage popup = new Stage();
        popup.setTitle(pkg.getName() + " (" + pkg.getVersion() + ")");
        popup.setScene(new Scene(loader.getRoot()));
        popup.initModality(Modality.NONE);
        popup.initOwner(applicationWindow);

        runnerActivityController.setAuthHandler(handler);
        runnerActivityController.setPackage(pkg, packageList);

        popup.showAndWait();
    } catch (IOException ex) {
        Logger.getLogger(EpicApp.class.getName()).log(Level.SEVERE, null, ex);
    }
}
 
开发者ID:Adobe-Consulting-Services,项目名称:aem-epic-tool,代码行数:22,代码来源:EpicApp.java

示例2: showPackageDiff

import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
public static void showPackageDiff(PackageType left, PackageType right, AuthHandler handler) {
    try {
        FXMLLoader loader = new FXMLLoader(EpicApp.class.getResource("/fxml/PackageCompare.fxml"));
        loader.setResources(ApplicationState.getInstance().getResourceBundle());
        loader.load();
        PackageCompareController runnerActivityController = loader.getController();

        Stage popup = new Stage();
        popup.setTitle("Package Comparison");
        popup.setScene(new Scene(loader.getRoot()));
        popup.initModality(Modality.NONE);
        popup.initOwner(applicationWindow);

        runnerActivityController.initDiffView(left, right, handler);

        popup.showAndWait();
    } catch (IOException ex) {
        Logger.getLogger(EpicApp.class.getName()).log(Level.SEVERE, null, ex);
    }
}
 
开发者ID:Adobe-Consulting-Services,项目名称:aem-epic-tool,代码行数:21,代码来源:EpicApp.java

示例3: showLaunchingScreen

import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
/**
   * Launch and show the launching screen
   */
  public void showLaunchingScreen(){
Stage promptWindow = new Stage();
promptWindow.setTitle(get_langBundle().getString("welcome"));
try {
	FXMLLoader loader = new FXMLLoader();
          loader.setLocation(getClass().getResource("/view/LaunchingScreen.fxml"));
          loader.setController(new LaunchingScreenController(this,promptWindow));
          loader.setResources(ResourceBundle.getBundle("bundles.Lang", _locale));
          BorderPane layout = (BorderPane) loader.load();
	Scene launchingScene = new Scene(layout,404,250);
	//ENLEVER LE COMMENTAIRE POUR ACTIVER LA BETA CSS FLAT DESIGN
	//rootLayout.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
	promptWindow.setScene(launchingScene);
	promptWindow.showAndWait();
	
	// if project empty -> launch interview creation
	if(this.getCurrentProject().getEntretiens().isEmpty()){
		rootLayout.setCenter(null);
		this.getRootLayoutController().newInterview();
	}
} catch (IOException e) {
	e.printStackTrace();
}
  }
 
开发者ID:coco35700,项目名称:uPMT,代码行数:28,代码来源:Main.java

示例4: start

import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
    instance = this;
    applicationWindow = stage;
    Locale locale = Locale.US;
    ApplicationState.getInstance().setResourceBundle(ResourceBundle.getBundle("Bundle", locale));
    FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/App.fxml"));
    loader.setResources(ApplicationState.getInstance().getResourceBundle());
    loader.load();
    Parent root = loader.getRoot();
    appController = loader.getController();

    Scene scene = new Scene(root);
    scene.getStylesheets().add("/styles/Styles.css");

    stage.setTitle("AEM External Package Inspect and Compare Tool");
    stage.setScene(scene);
    stage.show();
    applicationWindow.setOnCloseRequest(evt -> {
        Platform.exit();
        System.exit(0);
    });
}
 
开发者ID:Adobe-Consulting-Services,项目名称:aem-epic-tool,代码行数:24,代码来源:EpicApp.java

示例5: launchMainView

import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
/**
 * Load and sets the main vue (center)
 */
public void launchMainView(){
	try {
 	FXMLLoader loader = new FXMLLoader();
     loader.setLocation(getClass().getResource("/view/MainView.fxml"));
     loader.setController(mainViewController);
     loader.setResources(ResourceBundle.getBundle("bundles.Lang", _locale));
     BorderPane mainView = (BorderPane) loader.load();
	
     // Show the scene containing the root layout.
     Scene scene = new Scene(mainView);
     rootLayout.setCenter(mainView);
	}
	catch (IOException e) {
		e.printStackTrace();
	}
}
 
开发者ID:coco35700,项目名称:uPMT,代码行数:20,代码来源:Main.java

示例6: pickPropertyExtract

import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
private void pickPropertyExtract() {
	Stage promptWindow = new Stage();
	promptWindow.setTitle("Selection de l'extrait");
	try {
		main.getCurrentMoment().setCurrentProperty(property);
		FXMLLoader loader = new FXMLLoader();
		loader.setLocation(getClass().getResource("/view/SelectDescriptemePart.fxml"));
		loader.setController(new SelectDescriptemePartController(main, promptWindow, new TextArea(),Enregistrement.PROPERTY));
		loader.setResources(main._langBundle);
		BorderPane layout = (BorderPane) loader.load();
		Scene launchingScene = new Scene(layout);
		promptWindow.setScene(launchingScene);
		promptWindow.show();

	} catch (IOException e) {
		// TODO Exit Program
		e.printStackTrace();
	}
}
 
开发者ID:coco35700,项目名称:uPMT,代码行数:20,代码来源:TypePropertyRepresentation.java

示例7: pickExtract

import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
@FXML
public void pickExtract() {
	Stage promptWindow = new Stage();
	promptWindow.setTitle("Selection de l'extrait");
	try {
		FXMLLoader loader = new FXMLLoader();
		loader.setLocation(getClass().getResource("/view/SelectDescriptemePart.fxml"));
		loader.setController(new SelectDescriptemePartController(main, promptWindow, this.extraitEntretien, Enregistrement.MOMENT));
		loader.setResources(main._langBundle);
		BorderPane layout = (BorderPane) loader.load();
		Scene launchingScene = new Scene(layout);
		promptWindow.setScene(launchingScene);
		promptWindow.show();

	} catch (IOException e) {
		// TODO Exit Program
		e.printStackTrace();
	}
}
 
开发者ID:coco35700,项目名称:uPMT,代码行数:20,代码来源:MainViewController.java

示例8: start

import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) throws Exception {

    if (!Application.check()) {
        Alert alert = ComponentUtils.dialog(primaryStage, "", Application.getResource().getString("please.correct.install.maven"));
        alert.show();
        System.exit(0);
    }

    FXMLLoader loader = new FXMLLoader(Main.class.getResource("/me/pingcai/Main.fxml"));
    loader.setResources(Application.getResource());
    Parent root = loader.load();

    MainController controller = loader.getController();
    controller.setStage(primaryStage);

    primaryStage.setResizable(false);
    primaryStage.setTitle(Application.getResource().getString("app.name"));
    primaryStage.setScene(new Scene(root));
    primaryStage.show();
}
 
开发者ID:pingcai,项目名称:maven-package-gui-installer,代码行数:22,代码来源:Main.java

示例9: getControllerByView

import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
public BaseController getControllerByView(String viewName) {
    try {
        FXMLLoader loader = new FXMLLoader();
        loader.setResources(this.i18nMessages);
        loader.setLocation(Scrabble.class.getResource(viewName));
        Node view = loader.load();

        this.rootLayout.setCenter(view);

        return loader.getController();
    } catch (IOException e) {
        this.showGeneralApplicationError(e);

        return null;
    }
}
 
开发者ID:Chrisp1tv,项目名称:ScrabbleGame,代码行数:17,代码来源:Scrabble.java

示例10: initializeRootLayout

import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
/**
 * Initializes the root layout
 */
protected void initializeRootLayout() {
    try {
        // Load root layout from fxml file
        FXMLLoader loader = new FXMLLoader();
        loader.setResources(this.i18nMessages);
        loader.setLocation(Scrabble.class.getResource("view/RootLayout.fxml"));
        this.rootLayout = loader.load();

        // Show the scene containing the root layout
        Scene scene = new Scene(this.rootLayout);
        this.primaryStage.setScene(scene);

        RootLayoutController controller = loader.getController();
        controller.setScrabble(this);

        this.primaryStage.show();
    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
开发者ID:Chrisp1tv,项目名称:ScrabbleGame,代码行数:24,代码来源:Scrabble.java

示例11: handleExchangeLetterWithBag

import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
/**
 * Exchanges a letter with the bag
 */
@FXML
protected void handleExchangeLetterWithBag() {
    try {
        this.refreshScrabbleInterface();

        // Load letters exchanging view
        FXMLLoader loader = new FXMLLoader();
        loader.setResources(this.scrabble.getI18nMessages());
        loader.setLocation(Scrabble.class.getResource("view/ExchangeLetter.fxml"));
        VBox page = loader.load();

        // Create the dialog stage
        Stage dialogStage = new Stage();
        dialogStage.setMinWidth(ExchangeLettersController.EXCHANGE_LETTERS_STAGE_WIDTH);
        dialogStage.setMaxWidth(ExchangeLettersController.EXCHANGE_LETTERS_STAGE_WIDTH);
        dialogStage.setMinHeight(ExchangeLettersController.EXCHANGE_LETTERS_STAGE_HEIGHT);
        dialogStage.setMaxHeight(ExchangeLettersController.EXCHANGE_LETTERS_STAGE_HEIGHT);

        dialogStage.setTitle(this.scrabble.getI18nMessages().getString("exchangeLettersWithTheBag"));
        dialogStage.initModality(Modality.WINDOW_MODAL);
        dialogStage.initOwner(this.scrabble.getPrimaryStage());

        Scene scene = new Scene(page);
        dialogStage.setScene(scene);

        ExchangeLettersController controller = loader.getController();
        controller.setDialogStage(dialogStage);
        controller.setScrabble(this.scrabble);
        controller.initializeInterface();

        dialogStage.showAndWait();

        this.refreshLetters();
    } catch (IOException e) {
        this.scrabble.showGeneralApplicationError(e);
    }
}
 
开发者ID:Chrisp1tv,项目名称:ScrabbleGame,代码行数:41,代码来源:GameController.java

示例12: ModalDialog

import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
public ModalDialog(final Modal controller, URL fxml, Window owner, StageStyle style, Modality modality, ResourceBundle bundle) {
    super(style);
    initOwner(owner);
    initModality(modality);
    FXMLLoader loader = new FXMLLoader(fxml);
    loader.setResources(bundle);
    try {
        loader.setControllerFactory(new Callback<Class<?>, Object>() {
            public Object call(Class<?> aClass) {
                return controller;
            }
        });
        controller.setDialog(this);
        scene = new Scene((Parent) loader.load());
        setScene(scene);
    } catch (IOException e) {
        logger.error("Error loading modal class", e);
        throw new RuntimeException(e);
    }
}
 
开发者ID:stancalau,项目名称:springfx,代码行数:21,代码来源:ModalDialog.java

示例13: CreateUserDialog

import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
/**
 * A custom dialog for 'create user'.
 *
 * @param bundle The resource bundle, must not be null.
 * @param unitManager The unit manager, must not be null.
 */
public CreateUserDialog(ResourceBundle bundle, UnitManager unitManager) {
    requireNonNull(bundle);
    requireNonNull(unitManager);

    heightUnitConverter = unitManager.getHeightUnitConverter();

    setTitle(bundle.getString("dialog_create_user_title"));

    setHeaderText(bundle.getString("dialog_create_user_header_text"));
    setGraphic(createGlyph(ICON_USER));

    setResizable(false);

    FXMLLoader loader = new FXMLLoader(getClass().getResource(LAYOUT_FXML));
    loader.setResources(bundle);
    loader.setController(this);

    try {

        rootPane = loader.load();
        getDialogPane().setContent(rootPane);

        initFieldsAndValidation(bundle);

        getDialogPane().getButtonTypes().addAll(OK, CANCEL);

        setResultConverter(dialogButton -> {
            if (dialogButton != OK)
                return null;
            return createUser();
        });

    } catch (IOException e) {
        Log.error("Couldn't load FXML file '"+LAYOUT_FXML+"'!", e);
    }
}
 
开发者ID:tbressler,项目名称:waterrower-workout,代码行数:43,代码来源:CreateUserDialog.java

示例14: createFxmlLoader

import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
private FXMLLoader createFxmlLoader(String resource, ResourceBundle resourceBundle, View<?> codeBehind, Object root,
                                    ViewModel viewModel, ContextImpl context, ObservableBooleanValue viewInSceneProperty) throws IOException {
    // Load FXML file
    final URL location = FxmlViewLoader.class.getResource(resource);
    if (location == null) {
        throw new IOException("Error loading FXML - can't load from given resourcepath: " + resource);
    }

    final FXMLLoader fxmlLoader = new FXMLLoader();

    fxmlLoader.setRoot(root);
    fxmlLoader.setResources(resourceBundle);
    fxmlLoader.setLocation(location);

    // when the user provides a viewModel but no codeBehind, we need to use
    // the custom controller factory.
    // in all other cases the default factory can be used.
    if (viewModel != null && codeBehind == null) {
        fxmlLoader
                .setControllerFactory(new ControllerFactoryForCustomViewModel(viewModel, resourceBundle, context, viewInSceneProperty));
    } else {
        fxmlLoader.setControllerFactory(new DefaultControllerFactory(resourceBundle, context, viewInSceneProperty));
    }

    // When the user provides a codeBehind instance we take care of the
    // injection of the viewModel to this
    // controller here.
    if (codeBehind != null) {
        fxmlLoader.setController(codeBehind);

        if (viewModel == null) {
            handleInjection(codeBehind, resourceBundle, context, viewInSceneProperty);
        } else {
            handleInjection(codeBehind, resourceBundle, viewModel, context, viewInSceneProperty);
        }
    }

    return fxmlLoader;
}
 
开发者ID:cmlanche,项目名称:easyMvvmFx,代码行数:40,代码来源:FxmlViewLoader.java

示例15: init

import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
private void init(ResourceBundle bundle, String layoutFXML) {
    try {

        FXMLLoader loader = new FXMLLoader(getClass().getResource(layoutFXML));
        loader.setResources(bundle);
        loader.setRoot(this);
        loader.setController(this);

        loader.load();

    } catch (IOException e) {
        Log.error("Couldn't load FXML file '"+layoutFXML+"'!", e);
    }
}
 
开发者ID:tbressler,项目名称:waterrower-workout,代码行数:15,代码来源:AbstractPerspective.java


注:本文中的javafx.fxml.FXMLLoader.setResources方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。