List of usage examples for javafx.fxml FXMLLoader load
public <T> T load() throws IOException
From source file:main.Content.java
public void initRootLayout() { try {// w ww . j av a 2 s . c o m FXMLLoader loader = new FXMLLoader(); loader.setLocation(Content.class.getResource("view/ContentRoot.fxml")); rootLayout = (BorderPane) loader.load(); ContentRootController controller = loader.getController(); controller.setMainApp(this); } catch (IOException e) { e.printStackTrace(); } }
From source file:main.Content.java
public void initTabRootLayout(Activity totalSum) { try {/*from w w w. ja v a2 s . c o m*/ FXMLLoader loader = new FXMLLoader(); loader.setLocation(Main.class.getResource("view/TabRoot.fxml")); tabRootLayout = (TabPane) loader.load(); tabRootLayout.setStyle(Main.class.getResource("view/DarkTheme.css").toString()); chartTabController.setData(data); chartTabController.setTabPane(tabRootLayout); chartTabController.setMainApp(this); chartTabController.setActivitySum(totalSum); chartTabController.showChartOverview(); tabRootLayout = chartTabController.getTabPane(); rootLayout.setCenter(tabRootLayout); } catch (IOException e) { e.printStackTrace(); } }
From source file:main.Content.java
public void showChartOverview() { try {/*from ww w .j ava 2s .co m*/ FXMLLoader loader = new FXMLLoader(); loader.setLocation(Main.class.getResource("view/tabmenu/ChartTab.fxml")); GridPane chartOverview = (GridPane) loader.load(); tabRootLayout.getTabs().get(0).setContent(chartOverview); } catch (IOException e) { e.printStackTrace(); } }
From source file:ua.com.ecotep.debtprevention.VnaklController.java
@FXML private void handleDocSelectorAction(ActionEvent event) { if (selCl == null) { AlertDialog.showSimpleMessage("? .", AlertDialog.ICON_INFO, parentInterface.getCurrentWindow()); return;/* w w w. j av a 2s . c om*/ } Task<Object> task = DPSession.getInstance().getTask(); if ((task != null) && (task.isRunning())) { AlertDialog.showSimpleMessage( "? ?, -? .", AlertDialog.ICON_FORBIDDEN, parentInterface.getCurrentWindow()); return; } Scene sceneParent = parentInterface.getCurrentWindow().getScene(); final Point2D windowCoord = new Point2D(sceneParent.getWindow().getX(), sceneParent.getWindow().getY()); final Point2D sceneCoord = new Point2D(sceneParent.getX(), sceneParent.getY()); final Point2D nodeCoord = addDocButton.localToScene(0.0, 0.0); final double coordX = Math.round(windowCoord.getX() + sceneCoord.getX() + nodeCoord.getX()); final double coordY = Math .round(windowCoord.getY() + sceneCoord.getY() + nodeCoord.getY() + addDocButton.getHeight() + 6); try { selectorPopup = new Popup(); selectorPopup.setAutoHide(true); selectorPopup.setAutoFix(true); selectorPopup.setHideOnEscape(true); FXMLLoader loader = new FXMLLoader(); loader.setLocation(getClass().getResource("/fxml/DocSelectScene.fxml")); AnchorPane root = (AnchorPane) loader.load(); DocSelectController controller = loader.getController(); controller.setParentInterface(this); Scene scene = new Scene(root); scene.setFill(null); selectorPopup.getContent().add(root); selectorPopup.setX(coordX); selectorPopup.setY(coordY); selectorPopup.show(parentInterface.getCurrentWindow()); } catch (IOException ex) { Logger.getLogger(MainController.class.getName()).log(Level.SEVERE, null, ex); AlertDialog.showSimpleMessage( "? ? !", AlertDialog.ICON_ERROR, parentInterface.getCurrentWindow()); } }
From source file:main.Content.java
public void showTableOverview() { try {/*from w w w .java2 s.c o m*/ FXMLLoader loader = new FXMLLoader(); loader.setLocation(Main.class.getResource("view/TableLayout.fxml")); AnchorPane tableOverview = (AnchorPane) loader.load(); rootLayout.setBottom(tableOverview); TableOverviewController controller = loader.getController(); controller.setMainApp(this); controller.setTableData(data); } catch (IOException e) { e.printStackTrace(); } }
From source file:main.Content.java
public boolean showInputDialog(Activity aktivitet) { try {/*from w w w . ja v a 2 s . c o m*/ FXMLLoader loader = new FXMLLoader(); loader.setLocation(Main.class.getResource("view/InputDialog.fxml")); AnchorPane page = (AnchorPane) loader.load(); Stage dialogStage = new Stage(); dialogStage.setTitle("Data Input"); dialogStage.initModality(Modality.WINDOW_MODAL); dialogStage.initOwner(mainApp.getPrimaryStage()); Scene scene = new Scene(page); dialogStage.setScene(scene); InputDialogController controller = loader.getController(); controller.setListData(data); controller.setDialogStage(dialogStage); controller.setData(aktivitet); dialogStage.showAndWait(); return controller.isSaveClicked(); } catch (IOException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); return false; } }
From source file:com.properned.application.SystemController.java
@FXML public void openHelpDialog() { logger.info("Open the help dialog"); FXMLLoader loader = new FXMLLoader(); loader.setLocation(getClass().getResource("/com/properned/gui/helpFrame.fxml")); loader.setResources(MessageReader.getInstance().getBundle()); try {//w w w. j a va2 s .c om loader.load(); Parent root = loader.getRoot(); Stage modalDialog = new Stage(); modalDialog.setTitle(MessageReader.getInstance().getMessage("menu.help.help")); modalDialog.setResizable(true); modalDialog.getIcons().add(new Image("/com/properned/style/icon/icon_16.png")); Scene scene = new Scene(root); scene.getStylesheets().add("/com/properned/style/application.css"); modalDialog.setScene(scene); modalDialog.show(); } catch (IOException e) { Properned.getInstance().showError(MessageReader.getInstance().getMessage("error.openFrame"), e); } }
From source file:com.properned.application.SystemController.java
@FXML public void openAboutDialog() { logger.info("Open the about dialog"); FXMLLoader loader = new FXMLLoader(); loader.setLocation(getClass().getResource("/com/properned/gui/aboutFrame.fxml")); loader.setResources(MessageReader.getInstance().getBundle()); try {/* w w w . j a v a 2 s. c o m*/ loader.load(); Parent root = loader.getRoot(); Stage modalDialog = new Stage(StageStyle.UTILITY); modalDialog.initOwner(Properned.getInstance().getPrimaryStage()); modalDialog.setTitle(MessageReader.getInstance().getMessage("menu.help.about")); modalDialog.setResizable(false); Scene scene = new Scene(root); scene.getStylesheets().add("/com/properned/style/application.css"); modalDialog.setScene(scene); modalDialog.showAndWait(); } catch (IOException e) { Properned.getInstance().showError(MessageReader.getInstance().getMessage("error.openFrame"), e); } }
From source file:ExcelFx.FXMLDocumentController.java
@Override public void initialize(URL url, ResourceBundle rb) { this.Print.setDisable(true); footer.setItems(names);//from www.ja v a 2s. c om JsonWrite jsw = new JsonWrite(); File universityFile = new File("university.json"); File collegeFile = new File("college.json"); //File codesFile = new File("codes.json"); if ((universityFile.exists()) && (collegeFile.exists()) /*&& (codesFile.exists())*/) { try { this.universityJson.jsonRead("university.json"); this.collegeJson.jsonRead("college.json"); //this.codesJson.jsonRead("codes.json"); this.jsonXLSXData.setAll(universityJson, collegeJson/*, codesJson*/); } catch (IOException | ParseException ex) { Alert alert = new Alert(Alert.AlertType.INFORMATION); alert.setTitle(""); alert.setHeaderText(" ? ? "); alert.setContentText(ex.toString()); alert.showAndWait(); Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.SEVERE, null, ex); } } else { try { FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("FileOpenFXML.fxml")); this.fileOpenParent = (Parent) fxmlLoader.load(); Stage stage = new Stage(); stage.initModality(Modality.APPLICATION_MODAL); stage.initStyle(StageStyle.DECORATED); stage.setTitle(" "); stage.setScene(new Scene(this.fileOpenParent)); stage.showAndWait(); } catch (Exception e) { System.err.println(e); } this.jsonXLSXData.setAll(universityJson, collegeJson/*, codesJson*/); } }
From source file:com.properned.application.SystemController.java
@FXML public void openLocaleDialog() { logger.info("Open the locale dialog"); FXMLLoader loader = new FXMLLoader(); loader.setLocation(getClass().getResource("/com/properned/gui/localeFrame.fxml")); loader.setResources(MessageReader.getInstance().getBundle()); try {/* w w w . j a v a2s .c o m*/ loader.load(); Parent root = loader.getRoot(); Stage modalDialog = new Stage(StageStyle.UNIFIED); modalDialog.initModality(Modality.APPLICATION_MODAL); modalDialog.initOwner(Properned.getInstance().getPrimaryStage()); modalDialog.setTitle(MessageReader.getInstance().getMessage("manageLocale.title")); modalDialog.setResizable(true); modalDialog.getIcons().add(new Image("/com/properned/style/icon/icon_16.png")); Scene scene = new Scene(root); scene.getStylesheets().add("/com/properned/style/application.css"); modalDialog.setScene(scene); modalDialog.showAndWait(); } catch (IOException e) { Properned.getInstance().showError(MessageReader.getInstance().getMessage("error.openFrame"), e); } }