本文整理汇总了Java中javafx.fxml.JavaFXBuilderFactory类的典型用法代码示例。如果您正苦于以下问题:Java JavaFXBuilderFactory类的具体用法?Java JavaFXBuilderFactory怎么用?Java JavaFXBuilderFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JavaFXBuilderFactory类属于javafx.fxml包,在下文中一共展示了JavaFXBuilderFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
import javafx.fxml.JavaFXBuilderFactory; //导入依赖的package包/类
@Override
public void start(Stage primaryStage) throws Exception {
final Injector injector = Guice.createInjector(new WizardModule());
final URL fxml = WizardMain.class.getClassLoader().getResource("wizard-fxml/Wizard.fxml");
if (fxml != null) {
final Parent p = FXMLLoader.load(fxml,
null,
new JavaFXBuilderFactory(),
injector::getInstance
);
final Scene scene = new Scene(p);
primaryStage.setScene(scene);
primaryStage.setWidth(800);
primaryStage.setHeight(600);
primaryStage.setTitle("Java gEneric DAta Integration (JedAI) Toolkit");
primaryStage.show();
}
}
示例2: getPane
import javafx.fxml.JavaFXBuilderFactory; //导入依赖的package包/类
public static <T extends ContentPane> T getPane(Class<T> clazz) {
try {
ContentPane pane = clazz.newInstance();
URL fxmlUrl = pane.getFXMLUrl();
FXMLLoader fxmlLoader = new FXMLLoader(fxmlUrl);
fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory());
pane.setFXMLLoader(fxmlLoader);
fxmlLoader.setController(pane);
pane.setNode();
if (pane.showInSideBar()) {
panesList.add(pane);
}
return fxmlLoader.getController();
} catch (Exception e) {
OneClientLogging.error(e);
}
return null;
}
示例3: openLoginGui
import javafx.fxml.JavaFXBuilderFactory; //导入依赖的package包/类
public static void openLoginGui() {
try {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
URL fxmlUrl = classLoader.getResource("gui/mc_auth.fxml");
if (fxmlUrl == null) {
OneClientLogging.logger.error("An error has occurred loading mc_auth.fxml!");
return;
}
FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(fxmlUrl);
fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory());
Parent root = fxmlLoader.load(fxmlUrl.openStream());
Stage stage = new Stage();
stage.setTitle("One Client - Login to minecraft");
stage.getIcons().add(new Image("images/icon.png"));
stage.setResizable(false);
stage.initOwner(Main.stage);
stage.initModality(Modality.WINDOW_MODAL);
Scene scene = new Scene(root, 600, 300);
scene.getStylesheets().add("gui/css/theme.css");
stage.setScene(scene);
stage.initModality(Modality.WINDOW_MODAL);
stage.initOwner(Main.stage);
stage.show();
MinecraftAuthController controller = fxmlLoader.getController();
controller.stage = stage;
controller.buttonLogin.setDefaultButton(true);
controller.showLoginGui();
} catch (Exception e) {
OneClientLogging.error(e);
}
}
示例4: getInstallDir
import javafx.fxml.JavaFXBuilderFactory; //导入依赖的package包/类
public static void getInstallDir(Predicate<File> predicate) throws IOException {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
URL fxmlUrl = classLoader.getResource("gui/install_location.fxml");
if (fxmlUrl == null) {
OneClientLogging.logger.error("An error has occurred loading the fxml!");
}
FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(fxmlUrl);
fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory());
Parent root = fxmlLoader.load(fxmlUrl.openStream());
Stage stage = new Stage();
stage.setTitle("Select Install Location");
stage.getIcons().add(new Image("images/icon.png"));
stage.setResizable(false);
stage.initOwner(Main.stage);
stage.initModality(Modality.WINDOW_MODAL);
Scene scene = new Scene(root, 500, 150);
scene.getStylesheets().add("gui/css/theme.css");
stage.setScene(scene);
stage.show();
InstallLocation controller = fxmlLoader.getController();
controller.okButton.setOnAction(event -> {
predicate.test(new File(controller.locationField.getText()));
stage.close();
});
controller.browseButton.setOnAction(event -> {
DirectoryChooser directoryChooser = new DirectoryChooser();
File dir = new File(controller.locationField.getText());
if (dir.exists())
directoryChooser.setInitialDirectory(dir);
File selectedDirectory = directoryChooser.showDialog(stage);
if (selectedDirectory != null) {
controller.locationField.setText(selectedDirectory.getAbsolutePath());
}
});
controller.locationField.setText(Constants.getDefaultDir().getAbsolutePath());
}
示例5: show
import javafx.fxml.JavaFXBuilderFactory; //导入依赖的package包/类
public static void show() throws IOException {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
URL fxmlUrl = classLoader.getResource("gui/splash.fxml");
if (fxmlUrl == null) {
OneClientLogging.logger.error("An error has occurred loading instance_creation.fxml!");
return;
}
FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(fxmlUrl);
fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory());
Parent root = fxmlLoader.load(fxmlUrl.openStream());
stage = new Stage();
stage.setTitle("One Client - Loading");
stage.getIcons().add(new Image("images/icon.png"));
stage.setResizable(false);
stage.initOwner(Main.stage);
stage.initModality(Modality.WINDOW_MODAL);
Scene scene = new Scene(root, 600, 400);
scene.getStylesheets().add("gui/css/theme.css");
stage.setScene(scene);
splashScreenController = fxmlLoader.getController();
stage.show();
loaded = true;
}
示例6: setupLogController
import javafx.fxml.JavaFXBuilderFactory; //导入依赖的package包/类
public static void setupLogController() {
try {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
URL fxmlUrl = classLoader.getResource("gui/log.fxml");
if (fxmlUrl == null) {
OneClientLogging.logger.error("An error has occurred loading instance_creation.fxml!");
return;
}
FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(fxmlUrl);
fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory());
Parent root = fxmlLoader.load(fxmlUrl.openStream());
stage = new Stage();
stage.setTitle("One Client - Log");
stage.getIcons().add(new Image("images/icon.png"));
stage.setResizable(true);
stage.setAlwaysOnTop(false);
stage.initOwner(Main.stage);
stage.initModality(Modality.NONE);
Scene scene = new Scene(root, 600, 300);
scene.getStylesheets().add("gui/css/theme.css");
stage.setScene(scene);
logController = fxmlLoader.getController();
logController.setStage(stage);
TextAreaAppender.setTextArea(logController.logArea);
} catch (Exception e) {
OneClientLogging.error(e);
}
}
示例7: QueryPanePresentation
import javafx.fxml.JavaFXBuilderFactory; //导入依赖的package包/类
public QueryPanePresentation() {
final URL location = this.getClass().getResource("QueryPanePresentation.fxml");
final FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(location);
fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory());
try {
fxmlLoader.setRoot(this);
fxmlLoader.load(location.openStream());
controller = fxmlLoader.getController();
initializeLeftBorder();
initializeToolbar();
initializeBackground();
initializeAddQueryButton();
} catch (final IOException ioe) {
throw new IllegalStateException(ioe);
}
}
示例8: MessagePresentation
import javafx.fxml.JavaFXBuilderFactory; //导入依赖的package包/类
public MessagePresentation(final CodeAnalysis.Message message) {
this.message = message;
final URL location = this.getClass().getResource("MessagePresentation.fxml");
final FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(location);
fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory());
try {
fxmlLoader.setRoot(this);
fxmlLoader.load(location.openStream());
// Initialize
initializeMessage();
initializeNearLabel();
} catch (final IOException ioe) {
throw new IllegalStateException(ioe);
}
}
示例9: BackgroundThreadEntryPresentation
import javafx.fxml.JavaFXBuilderFactory; //导入依赖的package包/类
public BackgroundThreadEntryPresentation(final Thread thread) {
this.thread = thread;
final URL location = this.getClass().getResource("BackgroundThreadEntryPresentation.fxml");
final FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(location);
fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory());
try {
fxmlLoader.setRoot(this);
fxmlLoader.load(location.openStream());
initializeRippler();
initializeBackground();
initializeLabel();
initializeThreadRunningCheck();
} catch (final IOException ioe) {
throw new IllegalStateException(ioe);
}
}
示例10: ProjectPanePresentation
import javafx.fxml.JavaFXBuilderFactory; //导入依赖的package包/类
public ProjectPanePresentation() {
final URL location = this.getClass().getResource("ProjectPanePresentation.fxml");
final FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(location);
fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory());
try {
fxmlLoader.setRoot(this);
fxmlLoader.load(location.openStream());
controller = fxmlLoader.getController();
initializeRightBorder();
initializeBackground();
initializeToolbar();
initializeToolbarButton(controller.createComponent);
} catch (final IOException ioe) {
throw new IllegalStateException(ioe);
}
}
示例11: QueryPresentation
import javafx.fxml.JavaFXBuilderFactory; //导入依赖的package包/类
public QueryPresentation(final Query query) {
final URL location = this.getClass().getResource("QueryPresentation.fxml");
final FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(location);
fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory());
try {
fxmlLoader.setRoot(this);
fxmlLoader.load(location.openStream());
this.query = query;
initializeStateIndicator();
initializeProgressIndicator();
initializeActionButton();
initializeDetailsButton();
initializeTextFields();
} catch (final IOException ioe) {
throw new IllegalStateException(ioe);
}
}
示例12: MessageCollectionPresentation
import javafx.fxml.JavaFXBuilderFactory; //导入依赖的package包/类
public MessageCollectionPresentation(final Component component, final ObservableList<CodeAnalysis.Message> messages) {
this.messages = messages;
final URL location = this.getClass().getResource("MessageCollectionPresentation.fxml");
final FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(location);
fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory());
try {
fxmlLoader.setRoot(this);
fxmlLoader.load(location.openStream());
initializeHeadline(component);
initializeLine();
initializeErrorsListener();
} catch (final IOException ioe) {
throw new IllegalStateException(ioe);
}
}
示例13: TagPresentation
import javafx.fxml.JavaFXBuilderFactory; //导入依赖的package包/类
public TagPresentation() {
final URL location = this.getClass().getResource("TagPresentation.fxml");
final FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(location);
fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory());
try {
fxmlLoader.setRoot(this);
fxmlLoader.load(location.openStream());
initializeShape();
initializeLabel();
initializeMouseTransparency();
initializeTextFocusHandler();
} catch (final IOException ioe) {
throw new IllegalStateException(ioe);
}
}
示例14: FilePresentation
import javafx.fxml.JavaFXBuilderFactory; //导入依赖的package包/类
public FilePresentation(final Component component) {
final URL location = this.getClass().getResource("FilePresentation.fxml");
final FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(location);
fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory());
try {
fxmlLoader.setRoot(this);
fxmlLoader.load(location.openStream());
this.component.set(component);
initializeIcon();
initializeFileName();
initializeColors();
initializeRippler();
initializeMoreInformationButton();
} catch (final IOException ioe) {
throw new IllegalStateException(ioe);
}
}
示例15: createScene
import javafx.fxml.JavaFXBuilderFactory; //导入依赖的package包/类
private void createScene() {
try {
URL location = getClass().getResource("/fxml/photoviewer.fxml");
FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(location);
fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory());
Parent root = (Parent) fxmlLoader.load(location.openStream());
Scene scene = new Scene(root);
fxPanel.setScene(scene);
controller = (PhotoViewerController) fxmlLoader.getController();
controller.setPhoto(photo);
} catch (IOException ex) {
LOGGER.log(Level.SEVERE, null, ex);
}
}