本文整理了Java中javafx.fxml.FXMLLoader.<init>()
方法的一些代码示例,展示了FXMLLoader.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FXMLLoader.<init>()
方法的具体详情如下:
包路径:javafx.fxml.FXMLLoader
类名称:FXMLLoader
方法名:<init>
暂无
代码示例来源:origin: speedment/speedment
public FXMLLoader fxmlLoader() {
final FXMLLoader loader = new FXMLLoader(StandardCharsets.UTF_8);
loader.setControllerFactory(clazz -> MapStream.of(constructors)
.filterKey(clazz::isAssignableFrom)
.values()
.findFirst()
.map(Supplier::get)
.map(injector::inject)
.orElseThrow(() -> new SpeedmentToolException(
"FXML Controller '" + clazz.getName() +
"' have not been installed in " +
getClass().getSimpleName() + "."
)));
return loader;
}
代码示例来源:origin: pmd/pmd
public void showExportXPathToRuleWizard() {
ExportXPathWizardController wizard
= new ExportXPathWizardController(xpathExpressionProperty());
FXMLLoader loader = new FXMLLoader(getClass().getResource("fxml/xpath-export-wizard.fxml"));
loader.setController(wizard);
final Stage dialog = new Stage();
dialog.initOwner(designerRoot.getMainStage());
dialog.setOnCloseRequest(e -> wizard.shutdown());
dialog.initModality(Modality.WINDOW_MODAL);
Parent root;
try {
root = loader.load();
} catch (IOException e) {
throw new RuntimeException(e);
}
Scene scene = new Scene(root);
//stage.setTitle("PMD Rule Designer (v " + PMD.VERSION + ')');
dialog.setScene(scene);
dialog.show();
}
代码示例来源:origin: pmd/pmd
private Stage createStage(Stage mainStage) {
FXMLLoader loader = new FXMLLoader(DesignerUtil.getFxml("event-log.fxml"));
loader.setController(this);
final Stage dialog = new Stage();
dialog.initOwner(mainStage.getScene().getWindow());
dialog.initModality(Modality.NONE);
Parent root;
try {
root = loader.load();
} catch (IOException e) {
throw new IllegalStateException(e);
}
Scene scene = new Scene(root);
dialog.setScene(scene);
return dialog;
}
代码示例来源:origin: speedment/speedment
static void showNotification(FlowPane area, String message, Icon icon, Palette palette, Runnable onClose) {
final FXMLLoader loader = new FXMLLoader(NotificationController.class.getResource(NOTIFICATION_FXML));
final AtomicReference<NotificationController> ref = new AtomicReference<>();
loader.setControllerFactory(clazz -> {
代码示例来源:origin: pmd/pmd
FXMLLoader fxmlLoader = new FXMLLoader(DesignerUtil.getFxml("auxclasspath-setup-popup.fxml"));
代码示例来源:origin: pmd/pmd
= new FXMLLoader(DesignerUtil.getFxml("designer.fxml"));
代码示例来源:origin: pmd/pmd
private Stage createEditPropertyDialog() {
EditPropertyDialogController wizard = new EditPropertyDialogController();
FXMLLoader loader = new FXMLLoader(DesignerUtil.getFxml("edit-property-dialog.fxml"));
loader.setController(wizard);
final Stage dialog = new Stage();
dialog.initOwner(this.getScene().getWindow());
dialog.initModality(Modality.WINDOW_MODAL);
dialog.initStyle(StageStyle.UNDECORATED);
Parent root;
try {
root = loader.load();
} catch (IOException e) {
throw new IllegalStateException(e);
}
Scene scene = new Scene(root);
dialog.setTitle("Edit property");
dialog.setScene(scene);
dialog.setUserData(wizard);
return dialog;
}
代码示例来源:origin: pmd/pmd
try {
Stage popup = new Stage();
FXMLLoader loader = new FXMLLoader(DesignerUtil.getFxml("generate-xpath-from-stack-trace.fxml"));
Parent root = loader.load();
Button button = (Button) loader.getNamespace().get("generateButton");
代码示例来源:origin: jfoenixadmin/JFoenix
FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/ui/popup/MainPopup.fxml"));
loader.setController(new InputController());
toolbarPopup = new JFXPopup(loader.load());
代码示例来源:origin: org.codehaus.griffon/griffon-javafx
@Nonnull
protected FXMLLoader createFxmlLoader(@Nonnull URL viewResource) {
return new FXMLLoader(viewResource);
}
代码示例来源:origin: brunoborges/webfx
public static FXMLLoader load(Class clazz) {
final FXMLLoader loader = new FXMLLoader(FXUtil.class.getClassLoader().getResource(resource(clazz)));
return loader;
}
}
代码示例来源:origin: net.sf.gluebooster.java.booster/gb-basic
/**
* Loads and parses a fxml document.
*
* @param fxml
* the stream containing the document
* @param closeStream
* close the stream after processing
*/
public void load(InputStream fxml, boolean closeStream) throws Exception {
FXMLLoader loader = new FXMLLoader();
fxmlRoot = loader.load(fxml);
if (closeStream)
fxml.close();
}
代码示例来源:origin: eu.agrosense.spi/session
public WorldPane() {
log.finest("constructing world pane");
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("WorldPane.fxml"));
fxmlLoader.setRoot(this);
fxmlLoader.setController(this);
try {
fxmlLoader.load();
} catch (IOException exception) {
throw new RuntimeException(exception);
}
}
代码示例来源:origin: eu.agrosense.spi/session
public FailurePane() {
getStyleClass().add("failure");
setMinWidth(220.0d);
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("FailurePane.fxml"));
fxmlLoader.setRoot(this);
fxmlLoader.setController(this);
try {
fxmlLoader.load();
} catch (IOException exception) {
throw new RuntimeException(exception);
}
}
代码示例来源:origin: eu.agrosense.spi/session
@Override
public void run() {
try {
FXMLLoader loader = new FXMLLoader(getClass().getResource("Login.fxml"));
loader.setController(controller);
Parent root = (Parent) loader.load();
Scene scene = new Scene(root);
fxPanel.setScene(scene);
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
}
}
});
代码示例来源:origin: com.airhacks/afterburner.fx
FXMLLoader loadSynchronously(final URL resource, ResourceBundle bundle, final String conventionalName) throws IllegalStateException {
final FXMLLoader loader = new FXMLLoader(resource, bundle);
PresenterFactory factory = discover();
Callback<Class<?>, Object> controllerFactory = (Class<?> p) -> factory.instantiatePresenter(p, this.injectionContext);
loader.setControllerFactory(controllerFactory);
try {
loader.load();
} catch (IOException ex) {
throw new IllegalStateException("Cannot load " + conventionalName, ex);
}
return loader;
}
代码示例来源:origin: org.tentackle/tentackle-fx
/**
* Loads an object hierarchy from a FXML document.<br>
*
* @param <T> the object's type
* @param location the url
* @return the object
* @throws IOException if loading failed
*/
public static <T> T load(URL location) throws IOException {
FXMLLoader loader = new FXMLLoader(location, null, FxFactory.getInstance().getBuilderFactory());
return loader.load();
}
代码示例来源:origin: org.tentackle/tentackle-fx
/**
* Loads an object hierarchy from a FXML document.<br>
*
* @param <T> the object's type
* @param location the url
* @param resources the optional resources
* @return the object
* @throws IOException if loading failed
*/
public static <T> T load(URL location, ResourceBundle resources) throws IOException {
FXMLLoader loader = new FXMLLoader(location, resources, FxFactory.getInstance().getBuilderFactory());
return loader.load();
}
代码示例来源:origin: com.github.wshackle/poseList3DPlot
@Override
public void start(Stage stage) throws Exception {
FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/Scene.fxml"));
Parent root = loader.load();
Scene scene = new Scene(root);
scene.getStylesheets().add("/styles/Styles.css");
stage.setTitle("Pose List 3D Plot");
stage.setScene(scene);
FXMLController controller = loader.getController();
controller.setStage(stage);
stage.show();
}
代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine
/**
* Load a content from an FXML definition
*/
public static Object loadFXML(URL fxmlLocation, Object controller) {
Object result = null;
try {
Assert.notNull(fxmlLocation);
Assert.notNull(controller);
final FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(fxmlLocation);
fxmlLoader.setController(controller);
fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory());
result = fxmlLoader.load();
} catch (final Exception e) {
e.printStackTrace();
throw new IllegalArgumentException(e);
}
return result;
}
内容来源于网络,如有侵权,请联系作者删除!