Пример #1
0
  /**
   * Instancie un controleur secondaire pour la fenetre de consultation du mot à consulter
   *
   * @return
   */
  private Stage loadConsultation() {
    Stage stageConsultation = null;
    FXMLLoader fxmlLoader = new FXMLLoader(this.getClass().getResource("../dictionnaire_mot.fxml"));

    VBox rootConsultation = null;

    try {
      rootConsultation = (VBox) fxmlLoader.load();
      FXMLController_2 subController = (FXMLController_2) fxmlLoader.getController();

      subController.setController(this);
      subController.setMotAConsulter(model.motSelectionne);
      subController.setImage();
      subController.init();

      Scene sceneConsultation = new Scene(rootConsultation);
      stageConsultation = new Stage();
      stageConsultation.setScene(sceneConsultation);
      stageConsultation.setTitle("Consultation");

      setConsultWindowCloseHandler(stageConsultation, subController);

    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    return stageConsultation;
  }
 private void loadFXML() {
   FXMLLoader fxmlLoader = new FXMLLoader(Main.class.getResource("EntryTask.fxml"));
   fxmlLoader.setRoot(this);
   fxmlLoader.setController(this);
   try {
     fxmlLoader.load();
   } catch (IOException e) {
     // TODO 自動生成された catch ブロック
     e.printStackTrace();
   }
 }
  @Test
  public void testControllerInjection() throws IOException {
    URL location = getClass().getResource("rt_20471.fxml");
    ResourceBundle resources = ResourceBundle.getBundle("javafx.fxml.rt_20471");
    FXMLLoader fxmlLoader = new FXMLLoader(location, resources);

    fxmlLoader.load();
    RT_20471Controller controller = fxmlLoader.getController();
    assertEquals(controller.getLocation(), location);
    assertEquals(controller.getResources(), resources);
    assertTrue(controller.isInitialized());
  }
  public InteractionsListController() {
    logger.entry();
    FXMLLoader fxmlLoader =
        new FXMLLoader(getClass().getResource("/fxml/customcontrol/InteractionsList.fxml"));
    fxmlLoader.setController(this);
    fxmlLoader.setRoot(this);
    try {
      fxmlLoader.load();

    } catch (IOException ex) {
      logger.log(Level.FATAL, ex.getMessage(), ex);
    }
    logger.exit();
  }
Пример #5
0
  @Override
  public void start(Stage primaryStage) {
    try {
      TabPane page = (TabPane) FXMLLoader.load(Main.class.getResource("simple.fxml"));
      Scene scene = new Scene(page);
      primaryStage.setScene(scene);
      primaryStage.setTitle("Hotels");
      primaryStage.show();

      textf = (TextField) scene.lookup("#HotelNameTextb");
      Button create = (Button) scene.lookup("#CreateButton");
      create.setOnAction(this::handleButtonAction);

    } catch (Exception ex) {
      Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
    }
  }