Ejemplo n.º 1
0
  /** Initialisation de l'UI. */
  private void init(Stage primaryStage) throws Exception {
    primaryStage.setTitle("RestoFX");

    // Scene root
    StackPane root = new StackPane();
    root.setPadding(new Insets(16));

    // Scene
    Scene scene = new Scene(root, 480, 320);

    // Buttons
    notGood = new Button();
    notGood.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
    notGood.setText("Pas bien");
    notGood.setOnAction(new NotGoodFetchMenuActionHandler());

    good = new Button();
    good.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
    good.setText("Bien");
    good.setOnAction(new GoodFetchMenuActionHandler());

    // Label
    text = new TextArea();
    text.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
    VBox.setVgrow(text, Priority.ALWAYS);

    // Progress Bar
    progress = new ProgressBar();
    progress.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
    progress.setProgress(1);

    // Vertical layout
    VBox vbox = new VBox(16);
    vbox.setAlignment(Pos.TOP_LEFT);

    // Scene tree
    vbox.getChildren().addAll(notGood, good, text, progress);
    root.getChildren().add(vbox);

    // Set stage scene
    primaryStage.setScene(scene);

    // Setup RestoFX HTTP Client
    restoFXClient = new RestoFXClient("http://127.0.0.1:" + HTTP_PORT + "/");
  }