Ejemplo n.º 1
0
  public void askImageScreen() {

    Integer[] randomImageNumber = new Integer[49];
    for (int i = 0; i < randomImageNumber.length; i++) {
      randomImageNumber[i] = i;
    }
    Collections.shuffle(Arrays.asList((randomImageNumber)));

    String[] listOfImageAsk = new String[levelFactor];

    Group group = new Group();
    for (int i = 0; i < listOfImageAsk.length; i++) {
      Image image = allImages[randomImageNumber[i]];
      ImageView imageAsk = new ImageView(image);
      imageAsk.setId(randomImageNumber[i] + ".gif");
      listOfImageAsk[i] = (randomImageNumber[i] + ".gif");
      imageAsk.setX(i * 83);
      group.getChildren().add(imageAsk);
      System.out.println(listOfImageAsk[i]);
    }

    // scene3 elements

    Label instruction = new Label("RULES TO BE HERE");
    Button nextButton = new Button("NEXT");

    BorderPane layout3 = new BorderPane();

    layout3.setCenter(group);
    layout3.setTop(instruction);
    layout3.setBottom(nextButton);
    layout3.setAlignment(instruction, Pos.TOP_CENTER);
    layout3.setAlignment(nextButton, Pos.BASELINE_CENTER);
    nextButton.setOnAction(e -> checkResultScreen(listOfImageAsk));
    nextButton.setOnKeyPressed(e -> checkResultScreen(listOfImageAsk));

    scene3 = new Scene(layout3, 800, 600);
    window1.setScene(scene3);
  }
  public ConfigurationsDialogBuilder create(
      DependencyDotFileGenerator dependencyDotFileGenerator,
      GradleScriptPreferences preferences,
      Os os,
      String outputFileName) {
    this.outputFileName = outputFileName;
    this.dependencyDotFileGenerator = dependencyDotFileGenerator;
    this.preferences = preferences;
    this.os = os;
    dialog = new ConfigurationChoiceDialog(this);
    dialog.setResizable(true);
    dialog.initStyle(UTILITY);
    dialog.initModality(APPLICATION_MODAL);
    dialog.setIconified(false);
    dialog.centerOnScreen();
    dialog.borderPanel = BorderPaneBuilder.create().styleClass("dialog").build();
    dialog.stackPane = new StackPane();

    StackPane stackPane = dialog.stackPane;

    dialog.log = new TextArea();

    TextArea log = dialog.log;
    BorderPane borderPanel = dialog.borderPanel;

    // message
    dialog.configurationsBox = new VBox();

    VBox configurationsBox = dialog.configurationsBox;

    dialog.configurationsBox = configurationsBox;
    dialog.progressIndicator = new ProgressIndicator();

    ProgressIndicator progressIndicator = dialog.progressIndicator;

    stackPane.getChildren().add(log);
    stackPane.getChildren().add(progressIndicator);
    progressIndicator.setPrefSize(50, 50);
    progressIndicator.setMaxSize(50, 50);
    configurationsBox.setSpacing(15);
    configurationsBox.setAlignment(CENTER_LEFT);
    dialog.scrollPane = new ScrollPane();

    ScrollPane scrollPane = dialog.scrollPane;

    scrollPane.setContent(configurationsBox);
    dialog.borderPanel.setCenter(stackPane);
    BorderPane.setAlignment(configurationsBox, CENTER_LEFT);
    BorderPane.setMargin(configurationsBox, new Insets(MARGIN, MARGIN, MARGIN, 2 * MARGIN));

    // buttons
    dialog.buttonsPanel = new HBox();

    final HBox buttonsPanel = dialog.buttonsPanel;

    buttonsPanel.setSpacing(MARGIN);
    buttonsPanel.setAlignment(BOTTOM_CENTER);
    BorderPane.setMargin(buttonsPanel, new Insets(0, 0, 1.5 * MARGIN, 0));
    borderPanel.setBottom(buttonsPanel);
    borderPanel
        .widthProperty()
        .addListener(
            new ChangeListener<Number>() {
              public void changed(ObservableValue<? extends Number> ov, Number t, Number t1) {
                buttonsPanel.layout();
              }
            });
    dialog.scene = new Scene(borderPanel);
    dialog.setScene(dialog.scene);

    URL resource =
        ConfigurationsDialogBuilder.class.getResource(
            "/com/nurflugel/gradle/ui/dialogservice/dialog.css");
    String externalForm = resource.toExternalForm();

    // dialog.borderPanel.styleClass("dialog");
    dialog.getScene().getStylesheets().add(externalForm);

    return this;
  }