本文整理汇总了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);
}
}
示例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);
}
}
示例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();
}
}
示例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);
});
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
示例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;
}
}
示例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();
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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;
}
示例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);
}
}