List of usage examples for javafx.fxml FXMLLoader load
public static <T> T load(URL location, ResourceBundle resources) throws IOException
From source file:pe.edu.system.jcmr.util.UtilidadesFx.java
public void openWindow(String fxml) { try {/*w ww .j a v a2 s . c o m*/ Stage st = new Stage(); String lenguage = (String) SessionJCMR.getInstance().getContextObject("Lenguage"); log.debug("Open window , idioma :" + lenguage); Locale currentLocale = new Locale(lenguage); ResourceBundle rb = ResourceBundle.getBundle("in18/systemJCMR", currentLocale); Parent root; root = FXMLLoader.load(getClass().getResource(fxml), rb); Scene scena = new Scene(root); st.setScene(scena); st.show(); } catch (IOException e) { e.printStackTrace(); } }
From source file:view.EditorView.java
@Override public void start(Stage primaryStage) throws Exception { Platform.setImplicitExit(true);// w w w. j av a 2 s.co m bundle = ResourceBundle.getBundle("view.strings"); stage = primaryStage; try { Parent root = FXMLLoader.load(getClass().getResource("EditorMain.fxml"), bundle); Scene scene = new Scene(root); scene.getStylesheets().add(getClass().getResource("EditorMain.css").toExternalForm()); primaryStage.setMinWidth(scene.getRoot().minWidth(0) + 70); primaryStage.setMinHeight(scene.getRoot().minHeight(0) + 70); primaryStage.setScene(scene); // Set Icon primaryStage.getIcons().add(new Image(MainWindow.class.getResourceAsStream("icon.png"))); primaryStage.show(); } catch (Exception e) { FOKLogger.log(MainWindow.class.getName(), Level.SEVERE, "An error occurred", e); } }