Java Code Examples for javafx.fxml.FXMLLoader#load()
The following examples show how to use
javafx.fxml.FXMLLoader#load() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LoginController.java From Library-Assistant with Apache License 2.0 | 7 votes |
void loadMain() { try { Parent parent = FXMLLoader.load(getClass().getResource("/library/assistant/ui/main/main.fxml")); Stage stage = new Stage(StageStyle.DECORATED); stage.setTitle("Library Assistant"); stage.setScene(new Scene(parent)); stage.show(); LibraryAssistantUtil.setStageIcon(stage); } catch (IOException ex) { LOGGER.log(Level.ERROR, "{}", ex); } }
Example 2
Source File: FullImageView.java From neural-style-gui with GNU General Public License v3.0 | 6 votes |
public FullImageView(File imageFile, Consumer<ActionEvent> styleEvent, Consumer<ActionEvent> contentEvent, Consumer<ActionEvent> initEvent, ResourceBundle resources) { FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/imagePreviewTab.fxml")); fxmlLoader.setResources(resources); fxmlLoader.setController(this); fxmlLoader.setRoot(this); try { fxmlLoader.load(); } catch (IOException exception) { throw new RuntimeException(exception); } image.fitWidthProperty().bind(widthProperty()); image.fitHeightProperty().bind(heightProperty()); imageView = new MovingImageView(image); imageView.setImage(imageFile); EventStreams.eventsOf(style, ActionEvent.ACTION) .subscribe(styleEvent); EventStreams.eventsOf(content, ActionEvent.ACTION) .subscribe(contentEvent); EventStreams.eventsOf(init, ActionEvent.ACTION) .subscribe(initEvent); }
Example 3
Source File: SortMeApp.java From examples-javafx-repos1 with Apache License 2.0 | 6 votes |
@Override public void start(Stage primaryStage) throws Exception { FXMLLoader fxmlLoader = new FXMLLoader( SortMeApp.class.getResource("/sortme-fxml/SortMe.fxml") ); Parent p = fxmlLoader.load(); Scene scene = new Scene(p); scene.getStylesheets().add( "/sortme-css/sortme.css" ); primaryStage.setScene( scene ); primaryStage.setTitle( "SortMeApp" ); primaryStage.setOnShown((evt)-> { SortMeController controller = (SortMeController)fxmlLoader.getController(); controller.shuffle(); }); primaryStage.show(); }
Example 4
Source File: PokemonRegister.java From dctb-utfpr-2018-1 with Apache License 2.0 | 6 votes |
@Override public void start(Stage stage) throws Exception { FXMLLoader loader = new FXMLLoader(getClass().getResource("View/PokemonHome.fxml")); Parent root = loader.load(); PokemonHomeController homeController = (PokemonHomeController) loader.getController(); homeController.setMainStage(stage); Scene scene = new Scene(root); stage.setScene(scene); stage.show(); // Parent root = FXMLLoader.load(getClass().getResource("View/PokemonHome.fxml")); // // Scene scene = new Scene(root); // // stage.setScene(scene); // stage.show(); }
Example 5
Source File: JaceApplication.java From jace with GNU General Public License v2.0 | 6 votes |
public MetacheatUI showMetacheat() { if (cheatController == null) { cheatStage = new Stage(StageStyle.DECORATED); FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/fxml/Metacheat.fxml")); fxmlLoader.setResources(null); try { VBox node = fxmlLoader.load(); cheatController = fxmlLoader.getController(); Scene s = new Scene(node); cheatStage.setScene(s); cheatStage.setTitle("Jace: MetaCheat"); Utility.loadIcon("woz_figure.gif").ifPresent(cheatStage.getIcons()::add); } catch (IOException exception) { throw new RuntimeException(exception); } } cheatStage.show(); return cheatController; }
Example 6
Source File: StudentManagementController.java From School-Management-System with Apache License 2.0 | 5 votes |
@FXML void setBtnStudentMnge(ActionEvent event) { try { AnchorPane studentMgmt = FXMLLoader.load(getClass().getResource(("/sms/view/fxml/ManageStudents.fxml"))); manageStudents.getChildren().setAll(studentMgmt); }catch(IOException e){ System.out.println(e); } }
Example 7
Source File: Main_Controller.java From Path-of-Leveling with MIT License | 5 votes |
private void buildPopup() { FXMLLoader loader = new FXMLLoader(getClass().getResource("SelectBuild_Popup.fxml")); try { AnchorPane con = loader.load(); loader.<SelectBuild_PopupController>getController().hook(this); addBuildPopup = new JFXDialog(rootPane, con, JFXDialog.DialogTransition.CENTER); addBuildPopup.getStylesheets().add(getClass().getResource("/styles/style.css").toExternalForm()); //controller.passDialog(mLoad); addBuildPopup.show(); } catch (IOException ex) { Logger.getLogger(MainApp_Controller.class.getName()).log(Level.SEVERE, null, ex); } }
Example 8
Source File: ChannelInfoTreeDemo.java From phoebus with Eclipse Public License 1.0 | 5 votes |
@Override public void start(Stage primaryStage) throws IOException { FXMLLoader loader = new FXMLLoader(); loader.setLocation(this.getClass().getResource("ChannelInfoTree.fxml")); loader.load(); ChannelInfoTreeController controller = loader.getController(); Channel testChannel1 = Channel.Builder.channel("testChannel1").owner("testOwner") .with(property("testProperty1", "value1")) .with(property("testProperty2", "value2")) .with(property("testProperty3", "value3")) .with(tag("testTag1")) .with(tag("testTag2")) .build(); Channel testChannel2 = Channel.Builder.channel("testChannel2").owner("testOwner") .with(property("testProperty1", "value1")) .with(property("testProperty2", "value2")) .with(property("testProperty3", "value3")) .with(tag("testTag1")) .with(tag("testTag2")) .build(); controller.setChannels(Arrays.asList(testChannel1, testChannel2)); Parent root = loader.getRoot(); primaryStage.setScene(new Scene(root, 400, 400)); primaryStage.show(); }
Example 9
Source File: WidgetFontPopOver.java From phoebus with Eclipse Public License 1.0 | 5 votes |
/** * Create dialog * * @param font_prop {@link FontWidgetProperty} used to configure initial values. * @param fontChangeConsumer Will be called when user press OK to leave the popover. */ public WidgetFontPopOver ( final FontWidgetProperty font_prop, final Consumer<WidgetFont> fontChangeConsumer ) { try { final URL fxml = WidgetFontPopOver.class.getResource("WidgetFontPopOver.fxml"); final InputStream iStream = NLS.getMessages(WidgetFontPopOver.class); final ResourceBundle bundle = new PropertyResourceBundle(iStream); final FXMLLoader fxmlLoader = new FXMLLoader(fxml, bundle); final Node content = (Node) fxmlLoader.load(); setContent(content); final WidgetFontPopOverController controller = fxmlLoader.<WidgetFontPopOverController> getController(); controller.setInitialConditions( this, font_prop.getValue(), font_prop.getDefaultValue(), font_prop.getDescription(), fontChangeConsumer ); } catch ( final IOException ex ) { logger.log(Level.WARNING, "Unable to edit font.", ex); setContent(new Label("Unable to edit font.")); } }
Example 10
Source File: AdminMessageController.java From HealthPlus with Apache License 2.0 | 5 votes |
public AdminMessageController() { FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/fxml/adminMessage.fxml")); fxmlLoader.setRoot(this); fxmlLoader.setController(this); try { fxmlLoader.load(); } catch (IOException exception) { throw new RuntimeException(exception); } }
Example 11
Source File: MainApp.java From JavaFX with MIT License | 5 votes |
@Override public void start(Stage primaryStage) { primaryStage.setTitle("Event Handler Demo"); try { FXMLLoader loader = new FXMLLoader(getClass().getResource("EventHandlerDemo.fxml")); AnchorPane page = (AnchorPane)loader.load(); Scene scene = new Scene(page); primaryStage.setScene(scene); primaryStage.show(); } catch (IOException e) { System.err.println("Error loading EventHandlerDemo.fxml!"); e.printStackTrace(); } }
Example 12
Source File: Main.java From samples with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void start(Stage primaryStage) throws Exception{ Parent root = FXMLLoader.load(getClass().getResource("hellofx.fxml")); primaryStage.setTitle("Hello World"); primaryStage.setScene(new Scene(root)); primaryStage.show(); }
Example 13
Source File: EditAreaController.java From SmartCity-ParkingManagement with Apache License 2.0 | 5 votes |
public static void display(final String parkingAreaID) throws IOException, ParseException { //parkingAreaElement = new ParkingArea(parkingAreaID); final Stage window = new Stage(); final Parent editAreaParent = FXMLLoader.load(EditAreaController.class.getResource("EditArea.fxml")); window.initModality(Modality.APPLICATION_MODAL); //window.setTitle("Edit Parking Area: " + parkingAreaElement.getName()); window.setScene(new Scene(editAreaParent)); window.showAndWait(); }
Example 14
Source File: TabbedHMDPostEditor.java From Lipi with MIT License | 5 votes |
private void bindFxml() { FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("TabbedHMDPostEditor.fxml")); fxmlLoader.setRoot(this); fxmlLoader.setController(this); try { fxmlLoader.load(); } catch (IOException e) { System.out.println("Failed to load fxml"); ExceptionAlerter.showException(e); throw new RuntimeException(e); } }
Example 15
Source File: TabboardMain.java From mars-sim with GNU General Public License v3.0 | 5 votes |
@Override public void start(Stage primaryStage) throws Exception{ Parent root = FXMLLoader.load(getClass().getResource("/fxui/fxml/tabboard/main_view.fxml")); //FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/fxui/fxml/dashboard/oneSettler.fxml")); primaryStage.setTitle("Hello World"); primaryStage.setScene(new Scene(root, 1366, 768)); primaryStage.show(); }
Example 16
Source File: TextEditorPane.java From logbook-kai with MIT License | 5 votes |
public TextEditorPane() { try { FXMLLoader loader = InternalFXMLLoader.load("logbook/gui/text_editor_pane.fxml"); loader.setRoot(this); loader.setController(this); loader.load(); } catch (IOException e) { LoggerHolder.get().error("FXMLのロードに失敗しました", e); } }
Example 17
Source File: ImageManufactureOperationController.java From MyBox with Apache License 2.0 | 4 votes |
public ImageManufactureOperationController expandPane(TitledPane thePane) { try { String newFxml; if (thePane.equals(viewPane)) { newFxml = CommonValues.ImageManufactureViewFxml; } else if (thePane.equals(clipboardPane)) { newFxml = CommonValues.ImageManufactureClipboardFxml; } else if (thePane.equals(cropPane)) { newFxml = CommonValues.ImageManufactureCropFxml; } else if (thePane.equals(colorPane)) { newFxml = CommonValues.ImageManufactureColorFxml; } else if (thePane.equals(effectPane)) { newFxml = CommonValues.ImageManufactureEffectsFxml; } else if (thePane.equals(enhancementPane)) { newFxml = CommonValues.ImageManufactureEnhancementFxml; } else if (thePane.equals(scalePane)) { newFxml = CommonValues.ImageManufactureScaleFxml; } else if (thePane.equals(transformPane)) { newFxml = CommonValues.ImageManufactureTransformFxml; } else if (thePane.equals(shadowPane)) { newFxml = CommonValues.ImageManufactureShadowFxml; } else if (thePane.equals(marginsPane)) { newFxml = CommonValues.ImageManufactureMarginsFxml; } else if (thePane.equals(arcPane)) { newFxml = CommonValues.ImageManufactureArcFxml; } else if (thePane.equals(penPane)) { newFxml = CommonValues.ImageManufacturePenFxml; } else if (thePane.equals(textPane)) { newFxml = CommonValues.ImageManufactureTextFxml; } else if (thePane.equals(richTextPane)) { newFxml = CommonValues.ImageManufactureRichTextFxml; } else { return null; } FXMLLoader fxmlLoader = new FXMLLoader(FxmlStage.class.getResource(newFxml), AppVariables.currentBundle); Pane pane = fxmlLoader.load(); parent.rightPaneBox.getChildren().clear(); parent.rightPaneBox.getChildren().add(pane); ImageManufactureOperationController controller = (ImageManufactureOperationController) fxmlLoader.getController(); controller.initPane(parent); return controller; } catch (Exception e) { logger.error(e.toString()); return null; } }
Example 18
Source File: FXMLLoaderFactory.java From OEE-Designer with MIT License | 4 votes |
public static FXMLLoader eventResolverLoader() throws Exception { FXMLLoader fxmlLoader = new FXMLLoader(EventResolverController.class.getResource("EventResolver.fxml")); fxmlLoader.setResources(getDesignerLangBundle()); fxmlLoader.load(); return fxmlLoader; }
Example 19
Source File: FXMLLoaderFactory.java From OEE-Designer with MIT License | 4 votes |
public static FXMLLoader fileShareLoader() throws Exception { FXMLLoader fxmlLoader = new FXMLLoader(FileShareController.class.getResource("FileShare.fxml")); fxmlLoader.setResources(getDesignerLangBundle()); fxmlLoader.load(); return fxmlLoader; }
Example 20
Source File: Main.java From JFX-Browser with MIT License | 4 votes |
@Override public void start(Stage stage) throws Exception { FXMLLoader loader = new FXMLLoader(); loader.setLocation(getClass().getResource(FXMLS+"MainFXML.fxml")); Parent root = loader.load(); // the RootBorder is get to show pin dialoge box that will appear on a // screen pane.getChildren().add(root); Scene scene = new Scene(pane); scene.setOnKeyPressed(event -> { if (event.getCode() == KeyCode.P && event.isControlDown()) { JFXButton button = new JFXButton("Ok"); JFXTextField textfield = new JFXTextField(); button.addEventHandler(MouseEvent.MOUSE_CLICKED, (e6) -> { System.out.println("Pin is :" + textfield.getText()); Pattern ipAddress = Pattern.compile("[0-9]{4}"); Matcher m1 = ipAddress.matcher(textfield.getText()); boolean b1 = m1.matches(); if (b1) { //TabController ob = new TabController(); /* * FXMLLoader loader = new * FXMLLoader(getClass().getResource(Main.FXMLS+"Tab.fxml")); * try { loader.load(); } catch (Exception e) { // TODO * Auto-generated catch block e.printStackTrace(); } ob * = loader.getController(); // * ob.getHtmlAsPdf().setVisible(true); * ob.getHamburger().setDisable(true); * //ob.getHamburger().setDisable(false); * //ob.getBookmark().setDisable(false); */ } else { Notifications.create().title("Wronge Pin").text("Your pin is exceeding limit or your pin is consists\n" + "of invalid characters") .hideAfter(Duration.seconds(5)).showError(); } }); setDialouge(button, "Pin", "Please type your pin", textfield); Notifications.create().title("Pin Activation").text("You are going to access Pro-Verion.").hideAfter(Duration.seconds(3)).showInformation(); } if (event.getCode() == KeyCode.T && event.isControlDown()) { MainController mainCont = new MainController(); mainCont.creatNewTab(mainCont.getTabPane(), mainCont.getAddNewTab()); } }); scene.getStylesheets().add(getClass().getResource(CSS+"stylesheet.css").toExternalForm()); stage.setTitle("Jfx Browser"); stage.setScene(scene); stage.show(); setStage(stage); setScene(scene); }