Java 类javafx.fxml.FXMLLoader 实例源码

项目:git-rekt    文件:HomeScreenController.java   
/**
 * Displays the pop-up dialog which prompts staff members to log in to the system.
 *
 * @throws IOException
 */
@FXML
public void onStaffModeButtonClicked() throws IOException {
    Stage staffLoginDialogStage = new Stage();
    Parent staffLoginDialogRoot = FXMLLoader.load(
        getClass().getResource("/fxml/StaffLoginDialog.fxml")
    );
    Scene staffLoginDialog = new Scene(staffLoginDialogRoot);

    staffLoginDialogStage.getIcons().add(new Image("images/Logo.png"));
    staffLoginDialogStage.setScene(staffLoginDialog);
    staffLoginDialogStage.initModality(Modality.APPLICATION_MODAL);
    staffLoginDialogStage.initOwner(staffModeButton.getScene().getWindow());
    staffLoginDialogStage.setResizable(false);
    staffLoginDialogStage.setTitle("Authentication Required");
    staffLoginDialogStage.centerOnScreen();
    staffLoginDialogStage.show();
}
项目:UDE    文件:UDEDesktop.java   
@Override
public void start(final Stage stage) throws Exception {
    GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
    int width = gd.getDisplayMode().getWidth();
    int height = gd.getDisplayMode().getHeight();

    Scene scene = new Scene(FXMLLoader.load(UDEDesktop.class.getResource("resources/UDEDesktopWindow.fxml")), width, height);
    scene.setFill(null);
    scene.getStylesheets().add("resources/stylesheet.css");
    stage.setScene(scene);
    // stage.initStyle(StageStyle.UNDECORATED);
    stage.initStyle(StageStyle.TRANSPARENT);
    stage.setTitle("UDEDesktop");
    stage.setMinWidth(300);
    stage.setMinHeight(300);
    stage.show();
    stage.toBack();
}
项目:FYS_T3    文件:contactController.java   
@FXML
public void openHelp(ActionEvent event) throws IOException {
    Parent root = FXMLLoader.load(getClass().getResource("/fxml/helpPopup.fxml"));
    final Scene scene = new Scene(root);
    final Stage stage = new Stage();
    stage.setTitle("Help");
    stage.setScene(scene);
    stage.show();
    stage.setResizable(false);
    stage.centerOnScreen();

    root.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            if (ke.getCode() == KeyCode.ESCAPE) {
                System.out.println("Key Pressed: " + ke.getCode());
                stage.close();
            }
        }
    });
}
项目:osrs-data-converter    文件:App.java   
@Override
public void start(Stage stage) {
    App.stage = stage;
    try {
        Parent root = FXMLLoader.load(App.class.getResource("/ui/Main.fxml"));
        Scene scene = new Scene(root);
        scene.getStylesheets().add(getClass().getResource("/style.css").toExternalForm());
        stage.setTitle("OSRS Data To 317 Converter");       
        stage.centerOnScreen();
        stage.setResizable(false);
        stage.sizeToScene();
        stage.initStyle(StageStyle.UNDECORATED);
        stage.setScene(scene);  
        stage.getIcons().add(new Image(App.class.getResourceAsStream("/icons/icon.png")));
        stage.show();
    } catch(Exception e) {
        e.printStackTrace();
    }
}
项目:Money-Manager    文件:GoToOperation.java   
public void goToHelp(double positionX, double positionY) {
    try {
        Stage HelpStage = new Stage();
        Parent root = FXMLLoader.load(getClass().getResource("/view/Help.fxml"));
        Scene scene = new Scene(root,800,550);
        HelpStage.setScene(scene);
        HelpStage.setResizable(false);
        HelpStage.getIcons().add(new Image(getClass().getResourceAsStream("/imges/purse.png")));
        HelpStage.setTitle("Help");
        HelpStage.setX(positionX);
        HelpStage.setY(positionY);
        HelpStage.show();
    } catch(Exception e) {
        e.printStackTrace();
    }
}
项目:git-rekt    文件:EditPricesScreenController.java   
@FXML
private void onEditPriceClickedButton() throws IOException {

    Stage editPriceDialogStage = new Stage();
    Parent editPriceDialogRoot = FXMLLoader.load(
            getClass().getResource("/fxml/EditPriceDialog.fxml")
    );
    service = roomTableView.getSelectionModel().getSelectedItem();
    Scene editPriceDialog = new Scene(editPriceDialogRoot);

    editPriceDialogStage.getIcons().add(new Image("images/Logo.png"));
    editPriceDialogStage.setScene(editPriceDialog);
    editPriceDialogStage.initModality(Modality.APPLICATION_MODAL);
    editPriceDialogStage.initOwner(editPriceButton.getScene().getWindow());
    editPriceDialogStage.setResizable(false);
    editPriceDialogStage.setTitle("Edit Price");
    editPriceDialogStage.centerOnScreen();
    editPriceDialogStage.show();

}
项目:PDF_Invoice_generator    文件:GeneratorView.java   
@Override
public void start(Stage stage) {


    FXMLLoader loader = new FXMLLoader(getClass().getClassLoader().getResource("view.fxml"));

    GridPane gridPane = null;
    try {
        gridPane = loader.load();
    } catch (IOException e) {
        e.printStackTrace();
    }

    GeneratorController controller = loader.getController();

    Scene scene = new Scene(gridPane, 900, 450);
    stage.setTitle("Generator faktur Dtree");
    stage.setScene(scene);
    stage.setMaxHeight(842.0);
    stage.setMaxWidth(1366.0);
    stage.setResizable(true);
    stage.show();
}
项目:hygene    文件:AboutView.java   
/**
 * Creates an instance of a {@link AboutView}.
 *
 * @throws IOException if unable to load the controller
 */
@Inject
public AboutView(final FXMLLoader fxmlLoader) throws UIInitialisationException, IOException {
    stage = new Stage();
    stage.initStyle(StageStyle.UNDECORATED);
    stage.setResizable(false);

    final URL resource = getClass().getResource(ABOUT_VIEW);
    fxmlLoader.setLocation(resource);
    final Scene rootScene = new Scene(fxmlLoader.load());

    rootScene.addEventHandler(KeyEvent.KEY_PRESSED, event -> {
        if (event.getCode() == KeyCode.ESCAPE) {
            stage.hide();
        }
    });

    stage.setScene(rootScene);

    stage.focusedProperty().addListener((observable, oldValue, newValue) -> {
        if (!newValue) {
            stage.hide();
        }
    });
}
项目:ServerBrowser    文件:MainController.java   
private Parent loadFXML(final View view) {
    try {
        final FXMLLoader loader = new FXMLLoader();
        loader.setLocation(getClass().getResource(view.getFXMLPath()));
        loader.setResources(Client.lang);

        // Creating a new instance of the specified controller, controllers never have
        // constructor arguments, therefore this is supposedly fine.
        activeSubViewController = view.getControllerType().newInstance();
        loader.setController(activeSubViewController);
        return loader.load();
    } catch (final IOException | InstantiationException | IllegalAccessException exception) {
        Logging.error("Couldn't load view.", exception);
    }

    return new Label("Error loading view.");
}
项目:Transport-Production-Issue    文件:Main.java   
@Override
public void start(Stage primaryStage) throws Exception{
    Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
    primaryStage.setTitle("Hello World");
    primaryStage.setScene(new Scene(root, 800, 600));
    primaryStage.setMinHeight(600);
    primaryStage.setMinWidth(800);
    primaryStage.setTitle("Zagadnienie transportowo-produkcyjne");
    primaryStage.show();
}
项目:PhotoScript    文件:Controller.java   
/**
 * 设置canvas大小
 */
private void setCanvasSize() {
    try {
        FXMLLoader fxmlLoader = new FXMLLoader((getClass().getResource("size_chooser.fxml")));
        Parent root1 = fxmlLoader.load();
        Stage stage = new Stage(DECORATED);
        stage.setTitle("选择画布");
        Scene scene = new Scene(root1);
        sizeChooser = fxmlLoader.getController();
        stage.setScene(scene);
        stage.showAndWait();
        if (sizeChooser.getCanvas() != null) {
            canvas.setHeight(sizeChooser.getCanvas().getHeight());
            canvas.setWidth(sizeChooser.getCanvas().getWidth());
            canvas.setLayoutX(450 - canvas.getWidth() / 2);
            canvas.setLayoutY(300 - canvas.getHeight() / 2);
            Rectangle rectangle = new Rectangle(canvas.getWidth(), canvas.getHeight());
            rectangle.setLayoutX(canvas.getLayoutX());
            rectangle.setLayoutY(canvas.getLayoutY());
            mainPane.setClip(rectangle);
            GraphicsContext gc = canvas.getGraphicsContext2D();
            gc.setFill(Color.WHITE);
            gc.fillRect(0, 0, canvas.getWidth(), canvas.getHeight());
        } else {
            //不选择就退出程序
            System.exit(0);
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}
项目:GestureFX    文件:ArbitraryNodeSample.java   
@Override
public Node mkRoot() {
    try {
        Parent node  = FXMLLoader.load(getClass().getResource("/ComplexScene.fxml"));
        node.setPickOnBounds(true);
        node.setMouseTransparent(true);
        WebView webview = (WebView) node.lookup("webview");
        if(webview != null){
            webview.getEngine().load("http://purecss3.net/doraemon/doraemon_css3.html");
        }

        GesturePane pane = new GesturePane(new SubScene(node, 500, 500));
        VBox.setVgrow(pane, Priority.ALWAYS);
        Label description = new Label("Zoom and scroll on the SubScene below, " +
                                              "observe that controls in JavaFX are vectors " +
                                              "and that lighting effects are respected" +
                                              "(different zoom alters light distance).");
        description.setWrapText(true);
        description.setPadding(new Insets(16));
        return new VBox(description, pane);

    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
项目:FYS_T3    文件:submitController.java   
@FXML
public void openSubmitAction(ActionEvent event) throws IOException {
    Node node = (Node) event.getSource();
    final Stage stage = (Stage) node.getScene().getWindow();
    final Parent home = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
    final Scene hScene = new Scene(home);
    Parent root = FXMLLoader.load(getClass().getResource("/fxml/Submit.fxml"));
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();

    root.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            if (ke.getCode() == KeyCode.ESCAPE) {
                System.out.println("Key Pressed: " + ke.getCode());
                stage.setScene(hScene);
            }
        }
    });
}
项目:Luna-Exam-Builder    文件:MainApp.java   
public static boolean showEditQuestionDialog(Stage ps,Question question,String title){
    try {
        // Load the fxml file and create a new stage for the popup dialog.
        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(MainApp.class.getResource("view_controller/EditQuestion.fxml"));
        GridPane page = loader.load();

        // Create the dialog Stage.
        Stage dialogStage = new Stage();
        dialogStage.setTitle(title);
        dialogStage.getIcons().add(new Image(MainApp.class.getResourceAsStream("resources/icon.png")));
        dialogStage.initModality(Modality.WINDOW_MODAL);
        dialogStage.initOwner(ps);
        Scene scene = new Scene(page);
        dialogStage.setScene(scene);
        dialogStage.setWidth(450);
        dialogStage.setHeight(700);
        dialogStage.setResizable(false);

        // Set the question into the controller.
        EditQuestionCtrl controller = loader.getController();
        controller.dialogStage = dialogStage;
        controller.setQuestion(question);

        // Show the dialog and wait until the user closes it
        dialogStage.showAndWait();

        return controller.okClicked;
    } catch (IOException e) {
        e.printStackTrace();
        return false;
    }
}
项目:uPMT    文件:TypePropertyRepresentation.java   
private void pickPropertyExtract() {
    Stage promptWindow = new Stage();
    promptWindow.setTitle("Selection de l'extrait");
    try {
        main.getCurrentMoment().setCurrentProperty(property);
        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(getClass().getResource("/view/SelectDescriptemePart.fxml"));
        loader.setController(new SelectDescriptemePartController(main, promptWindow, new TextArea(),Enregistrement.PROPERTY));
        loader.setResources(main._langBundle);
        BorderPane layout = (BorderPane) loader.load();
        Scene launchingScene = new Scene(layout);
        promptWindow.setScene(launchingScene);
        promptWindow.show();

    } catch (IOException e) {
        // TODO Exit Program
        e.printStackTrace();
    }
}
项目:fwm    文件:TemplateTabController.java   
public static TemplateTabController startTemplateTab(Template template, Openable open) throws Exception {
    log.debug("static startNpcTab called.");

    Template ourT = template;
    if(template != null){
        log.debug("ourN got filled from backend");
        template = Backend.getTemplateDao().getFullTemplate(template.getID());
    }else
    {
        ourT = new Template();

    }

    FXMLLoader loader = new FXMLLoader();
    loader.setLocation(TemplateTabController.class.getResource("templateTab.fxml"));
    Tab rootLayout = (Tab)loader.load();
    TemplateTabController cr = (TemplateTabController)loader.getController();
    cr.start(rootLayout, ourT, open);
    return cr;
}
项目:QuickNote_Plus    文件:main.java   
@Override
public void start(Stage primaryStage) {
    try {
        AnchorPane root = (AnchorPane)FXMLLoader.load(getClass().getResource("LogInScreen.fxml")); 
        Scene scene = new Scene(root, 340, 370);
        scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
        primaryStage.setTitle("QuickNote Plus - Log in");
        primaryStage.setScene(scene);
        primaryStage.setResizable(false);
        primaryStage.show();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
项目:marathonv5    文件:UnitedStatesMapPane.java   
public UnitedStatesMapPane() {
    getStyleClass().add("map-pane");
    setMinSize(USE_PREF_SIZE, USE_PREF_SIZE);
    setPrefHeight(450);
    setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);

    liveMap.setId("liveMap");
    liveMap.setManaged(false);
        liveMap.setCache(true);
        liveMap.setCacheHint(CacheHint.SCALE);
    getChildren().add(liveMap);
    overlayGroup.setId("overlay");

    // setip map transforms
    liveMap.getTransforms().setAll(mapPreTranslate, mapScale, mapPostTranslate);
    // load map fxml
    try {
        statesGroup = FXMLLoader.load(UnitedStatesMapPane.class.getResource("us-states-map.fxml"));
    } catch (IOException e) {
        e.printStackTrace();
    }
    // set live map children
    liveMap.getChildren().addAll(statesGroup, overlayGroup);
}
项目:FYS_T3    文件:submitController.java   
@FXML
public void openHelp(ActionEvent event) throws IOException {
    Parent root = FXMLLoader.load(getClass().getResource("/fxml/helpPopup.fxml"));
    final Scene scene = new Scene(root);
    final Stage stage = new Stage();
    stage.setTitle("Help");
    stage.setScene(scene);
    stage.show();
    stage.setResizable(false);
    stage.centerOnScreen();

    root.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            if (ke.getCode() == KeyCode.ESCAPE) {
                System.out.println("Key Pressed: " + ke.getCode());
                stage.close();
            }
        }
    });
}
项目:bestia-palantir    文件:MainApplication.java   
@Override
public void start(Stage primaryStage) {
    LOG.info("Starting Hello JavaFX and Maven demonstration application");

    try {
        final Parent rootNode = FXMLLoader.load(getClass().getResource(MAIN_FXML));
        final Scene scene = new Scene(rootNode, 400, 200);
        primaryStage.setTitle("Bestia Palantir");
        primaryStage.setScene(scene);
        primaryStage.show();
    } catch (Exception e) {
        LOG.error("Error during startup.", e);
    }
}
项目:H-Uppaal    文件:MessagePresentation.java   
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);
    }
}
项目:joanne    文件:Gallery.java   
@Override
public void start(Stage stage) throws Exception {
    Parent root = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml"));
    XMLManager xml = new XMLManager();
    xml.setEnvConfiguration();
    stage.setMinWidth(600);
    stage.setMinHeight(650);
    Scene scene = new Scene(root);

    //Alert a = new Alert(AlertType.ERROR);

    scene.getStylesheets().add(getClass().getResource("style.css").toExternalForm());

    stage.getIcons().add(new Image(new URL(getClass().getResource("/gallery/images/iv.png").toExternalForm()).toString(),16,16,true,true));
    stage.setOnCloseRequest(event ->{
        System.exit(0);
    });
    stage.setScene(scene);
    stage.setTitle("Joanne");
    stage.show();

    this.stage = stage;
    if(new File(new EnvVars().getEnvironmentVariable(Environment.USER_HOME)+File.separator+"joanne"+File.separator+"google_drive").exists()){        
        System.out.println(Files.createDirectories(Paths.get(new EnvVars().getEnvironmentVariable(Environment.USER_HOME)+File.separator+"joanne"+File.separator+"google_drive")));
    }
    new File("/tmp/joanne").mkdir();
}
项目:FYS_T3    文件:submitController.java   
@FXML
public void openSubmit2(ActionEvent event) throws IOException {
    Node node = (Node) event.getSource();
    final Stage stage = (Stage) node.getScene().getWindow();
    final Parent home = FXMLLoader.load(getClass().getResource("/fxml/Submit.fxml"));
    final Scene hScene = new Scene(home);
    Parent root = FXMLLoader.load(getClass().getResource("/fxml/Submit2.fxml"));
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();

    root.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            if (ke.getCode() == KeyCode.ESCAPE) {
                System.out.println("Key Pressed: " + ke.getCode());
                stage.setScene(hScene);
            }
        }
    });
}
项目:redisfx    文件:RedisFxMain.java   
public void start(Stage primaryStage) throws Exception {

        FXMLLoader fxmlLoader = Fx.getFxmlLoader("/fxml/Main.fxml");

        BorderPane mainPane = fxmlLoader.load();
        MainController mainController = fxmlLoader.getController();
        mainController.setPrimaryStage(primaryStage);

        Icons.Logo.setToStage(primaryStage);

        primaryStage.setTitle(I18n.getString("app_title"));
        primaryStage.setScene(new Scene(mainPane));
        primaryStage.setWidth(950);
        primaryStage.setHeight(700);
        primaryStage.show();
    }
项目:uPMT    文件:Main.java   
/**
 * Initializes the root layout.
 */
private void initRootLayout() {
    try {
        // Load root layout from fxml file.
        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(getClass().getResource("/view/RootLayout.fxml"));
        loader.setResources(ResourceBundle.getBundle("bundles.Lang",new Locale("en", "EN")));
        this.rootLayoutController = new RootLayoutController(this, primaryStage);
        loader.setController(rootLayoutController);
        loader.setResources(get_langBundle());
        rootLayout = (BorderPane) loader.load();
        // Show the scene containing the root layout.
        Scene scene = new Scene(rootLayout);

        primaryStage.setScene(scene);
        primaryStage.setMaximized(true);
        primaryStage.show();

    } catch (IOException e) {
        e.printStackTrace();
    }
}
项目:Sifon-Industries    文件:Calc.java   
@Override
public void start(Stage stage) throws Exception {
    Parent root = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml"));

    Scene scene = new Scene(root);


    stage.setScene(scene);
    stage.getIcons().add(new Image("/icon.png"));
    stage.show();
    stage.setMinWidth(stage.getWidth());
    stage.setMinHeight(stage.getHeight());

    scene.setOnKeyPressed(e -> {
        if (e.getCode() == KeyCode.NUMPAD1 || e.getCode() == KeyCode.DIGIT1) {
            controller.keyPressed('1');
        }else if (e.getCode() == KeyCode.NUMPAD2 || e.getCode() == KeyCode.DIGIT2) {
            controller.keyPressed('2');
        }else if (e.getCode() == KeyCode.NUMPAD3 || e.getCode() == KeyCode.DIGIT3) {
            controller.keyPressed('3');
        }else if (e.getCode() == KeyCode.NUMPAD4 || e.getCode() == KeyCode.DIGIT4) {
            controller.keyPressed('4');
        }else if (e.getCode() == KeyCode.NUMPAD5 || e.getCode() == KeyCode.DIGIT5) {
            controller.keyPressed('5');
        }else if (e.getCode() == KeyCode.NUMPAD6 || e.getCode() == KeyCode.DIGIT6) {
            controller.keyPressed('6');
        }else if (e.getCode() == KeyCode.NUMPAD7 || e.getCode() == KeyCode.DIGIT7) {
            controller.keyPressed('7');
        }else if (e.getCode() == KeyCode.NUMPAD8 || e.getCode() == KeyCode.DIGIT8) {
            controller.keyPressed('8');
        }else if (e.getCode() == KeyCode.NUMPAD9 || e.getCode() == KeyCode.DIGIT9) {
            controller.keyPressed('9');
        }else if (e.getCode() == KeyCode.NUMPAD0 || e.getCode() == KeyCode.DIGIT0) {
            controller.keyPressed('0');
        }else if (e.getCode() == KeyCode.ADD || e.getCode() == KeyCode.PLUS) {
            controller.keyPressed('+');
        }else if (e.getCode() == KeyCode.SUBTRACT || e.getCode() == KeyCode.MINUS) {
            controller.keyPressed('-');
        }else if (e.getCode() == KeyCode.MULTIPLY) {
            controller.keyPressed('*');
        }else if (e.getCode() == KeyCode.DIVIDE || e.getCode() == KeyCode.SLASH) {
            controller.keyPressed('/');
        }else if (e.getCode() == KeyCode.ENTER || e.getCode() == KeyCode.EQUALS) {
            controller.keyPressed('=');
        }else if (e.getCode() == KeyCode.PERIOD || e.getCode() == KeyCode.COMMA || e.getCode() == KeyCode.DECIMAL) {
            controller.keyPressed('.');
        }else if (e.getCode() == KeyCode.BACK_SPACE) {
            controller.keyPressed('b');
        }else if (e.getCode() == KeyCode.ESCAPE || e.getCode() == KeyCode.DELETE) {
            controller.keyPressed('c');
        }
    });
}
项目:FloydWarshallSimulation    文件:FXMLDocumentController.java   
@FXML
private void nextButtonAction(ActionEvent e) throws IOException{
    value = vertex.getValue();


    //Will Initialize the number of vertex in targeted classes

    TableViewerController.steps = value;
    ManualInputController.steps = value;

    AnchorPane temp = null;

    if(matrixInput.isSelected())
    {
        temp  = FXMLLoader.load(getClass().getResource("VertexAndEdge.fxml"));
        CategoryChooserController.manualChecker = false;
    }

    else
    {
        temp  = FXMLLoader.load(getClass().getResource("ManualInput.fxml"));
        CategoryChooserController.manualChecker = true;
    }
    rootPane.getChildren().setAll(temp);
}
项目:Dr-Assistant    文件:PatientsController.java   
private void openPatientHistoryStage(Patient patient) {
    if (patient.getNumberOfPrescription() == 0) {
        Alert alert = new Alert(Alert.AlertType.INFORMATION);
        alert.setTitle("There is no prescription");
        alert.setHeaderText("History not found");
        alert.setContentText("There is no prescription to show");
        alert.showAndWait();
    } else {
        System.out.println("Go on");
        FXMLLoader fXMLLoader = new FXMLLoader(getClass().getResource("/view/patient/PatientHistory.fxml"));
        try {
            Parent root = fXMLLoader.load();
            PatientHistoryController controller = fXMLLoader.getController();
            controller.setPatient(patient);
            Stage stage = new Stage();
            stage.initModality(Modality.WINDOW_MODAL);
            stage.setTitle(patient.getName() + " History");
            stage.setScene(new Scene(root));
            stage.show();
        } catch (IOException ex) {
            Logger.getLogger(PatientsController.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
项目:eadlsync    文件:DiffView.java   
public void showDialog() {
    FXMLLoader loader = new FXMLLoader(getClass().getResource("/gui/diff/diff-view.fxml"));
    try {
        loader.setController(diffController);
        DialogPane root = loader.load();
        root.getStylesheets().add(getClass().getResource("/gui/diff/diff-view.css").toExternalForm());

        Alert alert = new Alert(Alert.AlertType.WARNING);
        alert.setTitle("Diff Viewer");
        alert.setResizable(true);
        alert.setDialogPane(root);
        alert.initModality(Modality.WINDOW_MODAL);

        Window window = alert.getDialogPane().getScene().getWindow();
        window.setOnCloseRequest(event -> window.hide());

        alert.showAndWait();

    } catch (IOException e) {
        e.printStackTrace();
    }
}
项目:DiaEd    文件:TemplateView.java   
public TemplateView(Store store, DiagramTemplate template) {
    this.store = store;
    this.template = template;

    FXMLLoader fxmlLoader = new FXMLLoader(
            getClass().getResource("/startup/template.fxml")
    );

    fxmlLoader.setRoot(this);
    fxmlLoader.setController(this);

    try {
        fxmlLoader.load();
    } catch (IOException exception) {
        throw new RuntimeException(exception);
    }

}
项目:CloneHero    文件:App.java   
@Override
public void start(Stage primaryStage) throws Exception {
    try {
        FXMLLoader loader = new FXMLLoader(getClass().getClassLoader().getResource("Menu.fxml"));
        Parent root = loader.load();
        MenuController controller = (MenuController) loader.getController();
        primaryStage.setTitle("Clone Hero");
        primaryStage.setScene(new Scene(root));
        primaryStage.setResizable(false);
        primaryStage.getIcons().add(new Image(getClass().getResource("/icon.png").toString()));
        primaryStage.show();
        controller.start();
    } catch (IOException e) {
        e.printStackTrace();
    }
}
项目:Squid    文件:SquidUIController.java   
private void launchTaskManager() {
    mainPane.getChildren().remove(taskManagerUI);
    try {
        taskManagerUI = FXMLLoader.load(getClass().getResource("TaskManager.fxml"));
        taskManagerUI.setId("TaskManager");
        VBox.setVgrow(taskManagerUI, Priority.ALWAYS);
        HBox.setHgrow(taskManagerUI, Priority.ALWAYS);
        mainPane.getChildren().add(taskManagerUI);
        showUI(taskManagerUI);
        manageRatiosMenu.setDisable(false);
        manageExpressionsMenu.setDisable(false);
        manageReportsMenu.setDisable(false);

    } catch (IOException | RuntimeException iOException) {
        System.out.println("taskManagerUI >>>>   " + iOException.getMessage());
    }
}
项目:creacoinj    文件:ClickableBitcoinAddress.java   
public ClickableBitcoinAddress() {
    try {
        FXMLLoader loader = new FXMLLoader(getClass().getResource("bitcoin_address.fxml"));
        loader.setRoot(this);
        loader.setController(this);
        // The following line is supposed to help Scene Builder, although it doesn't seem to be needed for me.
        loader.setClassLoader(getClass().getClassLoader());
        loader.load();

        AwesomeDude.setIcon(copyWidget, AwesomeIcon.COPY);
        Tooltip.install(copyWidget, new Tooltip("Copy address to clipboard"));

        AwesomeDude.setIcon(qrCode, AwesomeIcon.QRCODE);
        Tooltip.install(qrCode, new Tooltip("Show a barcode scannable with a mobile phone for this address"));

        addressStr = convert(address);
        addressLabel.textProperty().bind(addressStr);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
项目:Clash-Royale    文件:FXMLC.java   
public FXMLC()
{
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("NEWHOME.fxml"));
    fxmlLoader.setRoot(this);
    fxmlLoader.setController(this);

    try
    {
        fxmlLoader.load();
    } catch (IOException exception)
    {
        throw new RuntimeException(exception);
    }
    ChoiceBoxInit();
    thread.start();
    System.out.println("thread is active");
}
项目:Java-9-Programming-Blueprints    文件:ConnectToPhoneController.java   
public static void showAndWait() {
    try {
        FXMLLoader loader = new FXMLLoader(ConnectToPhoneController.class.getResource("/fxml/connect.fxml"));
        Stage stage = new Stage();
        stage.setScene(new Scene(loader.load()));
        stage.setTitle("Connect to Phone");
        stage.initModality(Modality.APPLICATION_MODAL);
        stage.showAndWait();
    } catch (IOException ex) {
        throw new RuntimeException(ex);
    }
}
项目:GUI-Sorting-Time-Comparison-using-JavaFx    文件:ReadDataController.java   
@FXML public void automate(ActionEvent event){
    System.out.println("AUTOMATE");
    try{
        ((Node)event.getSource()).getScene().getWindow().hide();
        Stage primaryStage = new Stage();
        FXMLLoader loader = new FXMLLoader();
        VBox root = (VBox)loader.load(getClass().getResource("automate.fxml").openStream());
        Scene scene = new Scene(root,200,150);
        primaryStage.setScene(scene);
        primaryStage.setResizable(false);
        primaryStage.setTitle("AUTOMATE");
        primaryStage.show();
    }catch(IOException e){
        System.out.println("IO Exception loading automate.fxml");
        e.printStackTrace();
    }
}
项目:FYS_T3    文件:statisticsController.java   
@FXML
public void openHelp(ActionEvent event) throws IOException {
    Parent root = FXMLLoader.load(getClass().getResource("/fxml/helpPopup.fxml"));
    final Scene scene = new Scene(root);
    final Stage stage = new Stage();
    stage.setTitle("Help");
    stage.setScene(scene);
    stage.show();
    stage.setResizable(false);
    stage.centerOnScreen();

    root.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            if (ke.getCode() == KeyCode.ESCAPE) {
                System.out.println("Key Pressed: " + ke.getCode());
                stage.close();
            }
        }
    });
}
项目:Clipcon-Client    文件:MainScene.java   
/** Show progress bar */
public void showProgressBar() {
    Platform.runLater(() -> {
        try {
            Parent toProgressBar = FXMLLoader.load(getClass().getResource("/view/ProgressBar.fxml"));
            Scene scene = new Scene(toProgressBar);
            scene.getStylesheets().add("resources/myprogressbar.css");
            progressBarStage = new Stage();

            int progressBarIndex = ProgressBarScene.getIndex();

            progressBarStage.initStyle(StageStyle.TRANSPARENT);
            progressBarStage.setScene(scene);
            progressBarStage.getIcons().add(new javafx.scene.image.Image("resources/Logo.png"));
            progressBarStage.initModality(Modality.WINDOW_MODAL);
            progressBarStage.show();
            progressBarStage.setX(Screen.getPrimary().getBounds().getWidth() - progressBarStage.getWidth() - 10);
            progressBarStage.setY(Screen.getPrimary().getBounds().getHeight() - progressBarStage.getHeight() - 50 - progressBarIndex * 55);

            progressBarStageArray[progressBarIndex] = progressBarStage;
        } catch (Exception e) {
            e.printStackTrace();
        }
    });
}
项目:CNU_TermProject_SoftwareEngineering    文件:PaymentController.java   
private Dialog getPayProgressDialog() {
    try {
        FXMLLoader loader = new FXMLLoader(
                getClass().getResource("/View/PayProgress.fxml")
        );
        Parent root = loader.load();
        dialog = new Dialog();
        dialog.setResizable(false);
        dialog.setDialogPane((DialogPane) root);
        dialog.initOwner(owner);
        dialog.initModality(Modality.WINDOW_MODAL);
        dialog.initStyle(StageStyle.UTILITY);

    } catch (IOException e) {
        System.out.println("Unable to load dialog FXML");
        e.printStackTrace();
    }
    return dialog;
}
项目:fxexperience2    文件:SliderControl.java   
private void initialize() {

        final FXMLLoader loader = new FXMLLoader();
        loader.setLocation(SliderControl.class.getResource("/fxml/FXMLSliderControl.fxml")); //NOI18N
        loader.setController(this);
        loader.setRoot(this);
        try {
            loader.load();
        } catch (IOException ex) {
            Logger.getLogger(SliderControl.class.getName()).log(Level.SEVERE, null, ex);
        }

        // when we detect a width change, we know node layout is resolved so we position stop in track
        thumb.widthProperty().addListener((ov, oldValue, newValue) -> {
            if (newValue.doubleValue() > 0) {
             thumbWidth = newValue.doubleValue();
            }
        });
    }