Beispiel #1
0
  @Override
  public void start(Stage primaryStage) throws Exception {
    GridPane grid = new GridPane();
    grid.setAlignment(Pos.CENTER);
    grid.setVgap(10);
    grid.setHgap(10);
    grid.setPadding(new Insets(25, 25, 25, 25));

    Scene sc = new Scene(grid, 500, 500);

    String css = Main.class.getResource("Login.css").toExternalForm();
    //        System.out.println(css);
    sc.getStylesheets().add(css);

    Text scenetitle = new Text("Welcome");
    //        scenetitle.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
    grid.add(scenetitle, 0, 0, 1, 1);

    Label userName = new Label("User Name:");
    grid.add(userName, 0, 1);

    TextField userTextField = new TextField("Мудак");
    grid.add(userTextField, 1, 1);

    Label pw = new Label("Password:"******"Sign in");
    HBox hbBtn = new HBox(10);
    hbBtn.setAlignment(Pos.BOTTOM_RIGHT);
    hbBtn.getChildren().add(btn);
    grid.add(hbBtn, 1, 4);

    final Text actiontarget = new Text();
    grid.add(actiontarget, 1, 6);

    btn.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            //                actiontarget.setFill(Color.FIREBRICK);
            actiontarget.setText("Pressed");
          }
        });

    //        grid.setGridLinesVisible(true);

    scenetitle.setId("welc");
    actiontarget.setId("act");

    primaryStage.setScene(sc);
    primaryStage.setTitle("Hello World");
    primaryStage.show();
  }
Beispiel #2
0
  public void displayPane() throws IOException {

    addStationsToCB();

    paneTop.getColumnConstraints().add(new ColumnConstraints(60));
    paneTop.getColumnConstraints().add(new ColumnConstraints(200));
    paneTop.getColumnConstraints().add(new ColumnConstraints(100));

    paneBot.getColumnConstraints().add(new ColumnConstraints(60));
    paneBot.getColumnConstraints().add(new ColumnConstraints(200));
    paneBot.getColumnConstraints().add(new ColumnConstraints(100));

    paneCenter.getColumnConstraints().add(new ColumnConstraints(300));

    paneTop.setPadding(new Insets(10, 10, 10, 10));
    paneTop.setAlignment(Pos.CENTER);
    paneTop.setHgap(5);
    paneTop.setVgap(5);

    paneBot.setPadding(new Insets(10, 10, 10, 10));
    paneBot.setAlignment(Pos.CENTER);
    paneBot.setHgap(5);
    paneBot.setVgap(5);

    paneTop.add(new Label("Station :"), 0, 0);
    paneTop.add(cbStations, 1, 0);
    paneTop.add(btOpen, 2, 0);

    paneBot.add(new Label("Quantity :"), 0, 0);
    paneBot.add(cbQuantity, 1, 0);
    paneBot.add(btShow, 2, 0);

    paneTop.setHalignment(btOpen, HPos.RIGHT);
    paneBot.setHalignment(btShow, HPos.RIGHT);

    paneCenter.setHgap(5);
    paneCenter.setVgap(5);
    paneCenter.setAlignment(Pos.CENTER);
    sp.setContent(paneCenter);
    sp.setVbarPolicy(ScrollPane.ScrollBarPolicy.ALWAYS);
    bp.setMargin(sp, new Insets(20, 50, 40, 50));
    bp.setTop(paneTop);
    bp.setCenter(sp);
    bp.setBottom(paneBot);

    btOpen.setOnAction(
        e -> {
          try {
            open();
          } catch (IOException er) {
            er.printStackTrace();
          }
        });

    btShow.setOnAction(e -> showGraph());
  }
Beispiel #3
0
  @Override
  public void start(Stage primaryStage) throws Exception {
    Random rand = new Random();

    GridPane layout = new GridPane();
    layout.setGridLinesVisible(true);
    layout.setAlignment(Pos.CENTER);
    layout.setVgap(2);
    layout.setHgap(2);
    layout.setPadding(new Insets(10, 10, 10, 10));

    int j = 0;
    for (int i = 0; i < 11; i++) {

      int newRandomNum = rand.nextInt((1 - 0) + 1) + 0;
      TextField number = new TextField();
      number.setText(Integer.toString(newRandomNum));

      if (i > 9) {
        if (j > 8) {
          break;
        } else {
          j++;
          i = 0;
        }
      }

      layout.add(number, j, i);
    }

    Scene scene = new Scene(layout, 300, 300);

    primaryStage.setScene(scene);
    primaryStage.show();
  }
  /**
   * Set lower and upper limits for an ordinate
   *
   * @param axis Axis to configure
   */
  void setOrdinateRange(final NumberAxis axis) {
    axis.setAutoRange(false);
    GridPane grid = new GridPane();
    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(new Insets(0, 10, 0, 10));
    final TextField tfMax;
    final TextField tfMin;
    final TextField tfTick;
    final TextField tfFuente;
    grid.add(new Label("Axis"), 0, 0);
    grid.add(new Label(axis.getLabel()), 1, 0);
    grid.add(new Label("Lower"), 0, 1);
    grid.add(tfMin = new TextField(), 1, 1);
    grid.add(new Label("Upper"), 0, 2);
    grid.add(tfMax = new TextField(), 1, 2);
    grid.add(new Label("Space"), 0, 3);
    grid.add(tfTick = new TextField(), 1, 3);

    tfMin.setText(String.valueOf(axis.getLowerBound()));
    tfMax.setText(String.valueOf(axis.getUpperBound()));
    tfTick.setText(String.valueOf(axis.getTickUnit().getSize()));

    new PseudoModalDialog(skeleton, grid, true) {
      @Override
      public boolean validation() {
        axis.setLowerBound(Double.valueOf(tfMin.getText()));
        axis.setUpperBound(Double.valueOf(tfMax.getText()));
        axis.setTickUnit(new NumberTickUnit(Double.valueOf(tfTick.getText())));
        return true;
      }
    }.show();
  }
 public FormPane() {
   setContent(grid);
   vbarPolicyProperty().set(ScrollBarPolicy.AS_NEEDED);
   setStyle("-fx-background-color:inherit;");
   grid.setHgap(5);
   grid.setVgap(5);
 }
  public InputDialog(final String title, final Object[] data) {
    initOwner(null);

    setTitle(title);

    if (0 != data.length % 2) {
      throw new IllegalArgumentException("Object data must be even!");
    }

    final Group root = new Group();
    final Scene scene = new Scene(root);
    setScene(scene);

    final GridPane gridpane = new GridPane();
    gridpane.setPadding(new Insets(5));
    gridpane.setHgap(5);
    gridpane.setVgap(5);

    for (int i = 0; i < data.length; i++) {
      if (0 == i % 2) {
        final Label label = new Label((String) data[i]);
        gridpane.add(label, 0, i / 2);
      } else {
        gridpane.add((Node) data[i], 1, (i - 1) / 2);
      }
    }

    gridpane.add(submit, 1, data.length / 2 + 1);
    GridPane.setHalignment(submit, HPos.RIGHT);
    root.getChildren().add(gridpane);
    sizeToScene();
    show();
  }
  @Override
  public void start(Stage primaryStage) throws Exception {
    Label fnameLbl = new Label(Msg.get(this, "firstName"));
    TextField fnameFld = new TextField();
    Label lnameLbl = new Label(Msg.get(this, "lastName"));
    TextField lnameFld = new TextField();
    Button okBtn = new Button(Msg.get(this, "OK"));
    Button cancelBtn = new Button(Msg.get(this, "cancel"));

    // The OK button should fill its cell
    okBtn.setMaxWidth(Double.MAX_VALUE);

    // Create a GridPane and set its background color to lightgray
    GridPane root = new GridPane();
    root.setGridLinesVisible(true);
    root.setHgap(10);
    root.setVgap(5);
    root.setStyle(Msg.get(this, "style"));

    // Add children to teh GridPane
    root.addRow(0, fnameLbl, fnameFld, okBtn);
    root.addRow(1, lnameLbl, lnameFld, cancelBtn);

    Scene scene = new Scene(root);
    primaryStage.setScene(scene);
    primaryStage.setTitle(Msg.get(this, "title"));
    primaryStage.show();
  }
Beispiel #8
0
  public GridPane addParameterPane() {
    // GridPane - Erzeugung und Initialisierung
    GridPane grid = new GridPane();
    grid.setVgap(5);

    // Überschrift - Erzeugung und Hinzufügen zu GridPane
    Text title = new Text("Einstellungen");
    grid.add(title, 0, 0);

    // Game Zone Size UI Elemente - Erzeugung und Hinzufügen zu GridPane
    Text gameZoneSizeLabel = new Text("Size of Gamezone:");
    grid.add(gameZoneSizeLabel, 0, 1);

    TextField gameZoneSizeTextField = new TextField();
    grid.add(gameZoneSizeTextField, 1, 1);

    // Cell Number UI Elemente - Erzeugung und Hinzufügen zu GridPane
    Text numberOfLifeCellsLabel = new Text("Number of Life Cells:");
    grid.add(numberOfLifeCellsLabel, 0, 2);

    TextField numberOfLifeCellsTextField = new TextField();
    grid.add(numberOfLifeCellsTextField, 1, 2);

    return grid;
  }
Beispiel #9
0
  private void initContent(GridPane pane) {

    pane.setGridLinesVisible(!true);
    pane.setHgap(20);
    pane.setVgap(10);
    pane.setPadding(new Insets(20));

    Label lblExcursions = new Label("Excursions:");
    Label lblHotels = new Label("Hotels");
    Label lblParticipants = new Label("Participants");

    pane.add(lblExcursions, 0, 0);
    pane.add(lblHotels, 1, 0);
    pane.add(lblParticipants, 2, 0);

    this.excursions = new ListView<Excursion>();
    this.excursions.setPrefSize(200, 200);
    this.excursions.setPrefHeight(200);
    pane.add(this.excursions, 0, 1);

    this.hotels = new ListView<>();
    this.hotels.setPrefSize(200, 200);
    this.hotels.setPrefHeight(200);
    pane.add(this.hotels, 1, 1);

    this.participants = new ListView<>();
    this.participants.setPrefSize(200, 200);
    pane.add(this.participants, 2, 1);

    Button btnClose = new Button("Close");
    pane.add(btnClose, 0, 2);
    btnClose.setOnAction(event -> this.controller.closeOnAction());
  }
  public FXDialog() {
    // Setup general stage and main grid
    msgLabel = detLabel = null;
    stage = new Stage();
    stage.initModality(Modality.WINDOW_MODAL);
    grid = new GridPane();
    grid.setAlignment(Pos.CENTER);
    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(new Insets(10, 10, 10, 10));

    // Add the OK button (it's a default)
    buttonArea = new HBox(10);
    Button okBtn = new Button("OK");
    okBtn.setOnAction(
        event -> {
          okPressed = true;
          stage.hide();
        });
    buttonArea.getChildren().add(okBtn);
    grid.add(buttonArea, 1, 2);

    // ImageView imageView = new ImageView();
    // grid.add(imageView, 0, 0);

    // Add a 50 width pane for spacing and also as we plan on adding an image at 0,0
    // some time in the future
    Pane pane = new Pane();
    pane.setMinWidth(50);
    grid.add(pane, 0, 1);

    stage.setScene(new Scene(grid, 250, 100));
    okPressed = false;
  }
  @Override
  public void start(Stage stage) {
    stage.setTitle("URL Lister");
    Scene scene = new Scene(new Group(), 1250, 700);

    GridPane grid = new GridPane();
    grid.setVgap(4);
    grid.setHgap(10);
    grid.setPadding(new Insets(5, 5, 5, 5));
    grid.add(new Label("Server: "), 0, 0);
    grid.add(new Label("URL: "), 0, 1);
    grid.add(subject, 1, 1, 3, 1);
    grid.add(text, 1, 60, 2, 10);
    grid.add(text2, 10, 60, 2, 10);
    grid.add(text3, 10, 20, 2, 5);
    grid.add(button, 0, 3);
    grid.add(button2, 5, 60);
    grid.add(button3, 5, 65);
    grid.add(notification, 1, 3, 3, 1);

    Group root = (Group) scene.getRoot();
    root.getChildren().add(grid);
    stage.setScene(scene);
    stage.show();
  }
Beispiel #12
0
  @Override // Override the start method in the Application class
  public void start(Stage primaryStage) throws Exception {
    // Create a pane and set its properties
    GridPane pane = new GridPane();
    pane.setAlignment(Pos.CENTER);
    pane.setPadding(new Insets(11.5, 12.5, 13.5, 14.5));
    pane.setHgap(5.5);
    pane.setVgap(5.5);

    // Place nodes in the pane
    pane.add(new Label("First Name:"), 0, 0);
    pane.add(new TextField(), 1, 0);
    pane.add(new Label("MI:"), 0, 1);
    pane.add(new TextField(), 1, 1);
    pane.add(new Label("Last Name:"), 0, 2);
    pane.add(new TextField(), 1, 2);
    Button btAdd = new Button("Add Name");
    pane.add(btAdd, 1, 3);
    GridPane.setHalignment(btAdd, HPos.RIGHT);

    // Create a scene and place it in the stage
    Scene scene = new Scene(pane);
    primaryStage.setTitle("ShowGridPane"); // Set the stage title
    primaryStage.setScene(scene); // Place the scene in the stage
    primaryStage.show(); // Display the stage
  }
Beispiel #13
0
  @Override
  protected BorderPane getPane() {

    BorderPane pane = new BorderPane();
    GridPane paneFullTime = new GridPane();

    paneFullTime.setAlignment(Pos.CENTER);
    paneFullTime.setPadding(new Insets(11, 12, 13, 14));
    paneFullTime.setHgap(5.5);
    paneFullTime.setVgap(5.5);

    paneFullTime.add(text, 0, 0);
    paneFullTime.add(tfSSN, 1, 0);

    paneFullTime.add(arrNonCreditChBox[0], 0, 2);
    paneFullTime.add(arrNonCreditChBox[1], 0, 3);
    paneFullTime.add(arrNonCreditChBox[2], 0, 4);
    paneFullTime.add(submitBt, 1, 5);

    pane.setCenter(paneFullTime);

    submitBt.setOnAction(
        e -> {
          checkingRequirements();
          connectToDB();
          submitToDB();
          pane.setCenter(new Congratulation().getPane());
        });
    return pane;
  }
  /** @see javafx.scene.control.Cell#updateItem(java.lang.Object, boolean) */
  @Override
  protected void updateItem(ResultsItem item, boolean empty) {
    super.updateItem(item, empty);
    if (item != null) {
      setText("");

      GridPane gp = new GridPane();
      gp.setHgap(0.0);
      gp.setVgap(0.0);
      gp.setPadding(new Insets(5, 5, 5, 5));
      gp.setMinWidth(250);

      ColumnConstraints constraint1 = new ColumnConstraints();
      constraint1.setFillWidth(false);
      constraint1.setHgrow(Priority.NEVER);
      constraint1.setMinWidth(160);
      constraint1.setMaxWidth(160);
      gp.getColumnConstraints().add(constraint1);

      ColumnConstraints constraint2 = new ColumnConstraints();
      constraint2.setFillWidth(true);
      constraint2.setHgrow(Priority.SOMETIMES);
      gp.getColumnConstraints().add(constraint2);

      int row = 0;

      gp.add(wrapAndStyle(makeBoldLabel("Message"), row), 0, row);
      Label message = new Label(item.getMessage());
      message.setWrapText(true);
      message.maxWidthProperty().bind(this.widthProperty().subtract(180));
      gp.add(wrapAndStyle(message, row), 1, row++);

      gp.add(wrapAndStyle(makeBoldLabel("Severity"), row), 0, row);
      Label severity = new Label(item.getSeverity().getName());
      severity.setWrapText(true);
      severity.maxWidthProperty().bind(this.widthProperty().subtract(180));
      gp.add(wrapAndStyle(severity, row), 1, row++);

      gp.add(wrapAndStyle(makeBoldLabel("Rule UUID"), row), 0, row);
      Label ruleUUID = new Label(item.getRuleUuid());
      ruleUUID.setWrapText(true);
      ruleUUID.maxWidthProperty().bind(this.widthProperty().subtract(180));
      gp.add(wrapAndStyle(ruleUUID, row), 1, row++);

      gp.add(wrapAndStyle(makeBoldLabel("Error Code"), row), 0, row);
      Label errorCode = new Label(item.getErrorCode() + "");
      errorCode.setWrapText(true);
      errorCode.maxWidthProperty().bind(this.widthProperty().subtract(180));
      gp.add(wrapAndStyle(errorCode, row), 1, row++);

      setGraphic(gp);
      this.setStyle("-fx-border-width:  0 0 2 0; -fx-border-color: grey; ");

    } else {
      setText("");
      setGraphic(null);
      this.setStyle("");
    }
  }
  /** Shows this Notifications popup */
  public void show() {
    // Use a gridpane to display the component
    GridPane pane = new GridPane();
    // Need a new scene to display the popup
    Scene scene = new Scene(pane);

    // Set the padding and gaps to 5px
    pane.setPadding(new Insets(5));
    pane.setHgap(5);
    pane.setVgap(5);

    // Add the message as a label if there is one
    if (message != null) {
      Label lblMsg = new Label(message);

      lblMsg.setPadding(new Insets(20));
      pane.add(lblMsg, 0, 0, 3, 1);
    }

    // Add the yes/no buttons if there are any
    if (yesNoBtns) {
      Button btnYes = new Button("Yes");
      Button btnNo = new Button("No");

      // Add the events and set as default/cancel buttons
      btnYes.setDefaultButton(true);
      btnYes.setOnAction(yesNoEvent);
      btnNo.setCancelButton(true);
      btnNo.setOnAction(yesNoEvent);

      // Align them to the right
      GridPane.setHalignment(btnNo, HPos.RIGHT);
      GridPane.setHalignment(btnYes, HPos.RIGHT);

      // Push the buttons to the right
      Region spacer = new Region();
      GridPane.setHgrow(spacer, Priority.ALWAYS);

      pane.add(spacer, 0, 1);
      pane.add(btnNo, 1, 1);
      pane.add(btnYes, 2, 1);
    }

    // Create a new stage to show the scene
    Stage stage = new Stage();

    stage.setScene(scene);
    // Don't want the popup to be resizable
    stage.setResizable(false);
    // Set the title if there is one
    if (title != null) {
      stage.setTitle(title);
    }
    // Resize it and show it
    stage.sizeToScene();
    stage.showAndWait();
  }
Beispiel #16
0
  private GridPane createGridPane() {
    GridPane grid = new GridPane();
    grid.setHgap(hGap);
    grid.setVgap(vGap);
    grid.setPadding(new Insets(topOffset, rightOffset, bottomOffset, leftOffset));
    grid.setAlignment(Pos.CENTER);

    return grid;
  }
Beispiel #17
0
  private GridPane getNewGrid() {
    GridPane grid = new GridPane();
    grid.setVgap(10);
    grid.setHgap(5);
    // grid.setGridLinesVisible(true);
    grid.paddingProperty().set(new Insets(5));

    // GridPane.setVgrow(grid, Priority.ALWAYS);
    // grid.setMinWidth(500);

    ColumnConstraints col = new ColumnConstraints();

    col.setMinWidth(10);
    col.setHgrow(Priority.SOMETIMES);
    col.setFillWidth(true);

    // col.setPercentWidth(1);
    col.setPrefWidth(100);

    grid.getColumnConstraints().addAll(col, col);

    // ------

    RowConstraints row1 = new RowConstraints();
    RowConstraints row2 = new RowConstraints();

    row1.setMinHeight(10);
    row1.setVgrow(Priority.SOMETIMES);
    row1.setFillHeight(true);
    row1.setPrefHeight(30);

    row2.setMinHeight(10);
    row2.setVgrow(Priority.SOMETIMES);
    row2.setFillHeight(true);
    row2.setValignment(VPos.CENTER);

    grid.getRowConstraints().addAll(row1, row2);

    // ColumnConstraints c = new ColumnConstraints();
    // c.setHgrow(Priority.SOMETIMES);
    // c.setMaxWidth(173.0);
    // c.setMinWidth(10.0);
    // c.setPrefWidth(124.0);
    // grid.getColumnConstraints().add(c);

    // c = new ColumnConstraints();
    // c.setHalignment(HPos.RIGHT);
    // c.setHgrow(Priority.NEVER);
    // grid.getColumnConstraints().add(c);

    // RowConstraints r = new RowConstraints();
    // r.setVgrow(Priority.NEVER);
    // grid.getRowConstraints().add(r);

    return grid;
  }
  @FXML
  private void HandleLinkButtonAction(ActionEvent event) {
    String link = SourceText.getSelectedText();

    // Create the custom dialog.
    Dialog<Pair<String, String>> dialog = new Dialog<>();
    dialog.setTitle("Détail du lien");
    dialog.setHeaderText("");

    // Set the icon (must be included in the project).
    dialog.setGraphic(
        new ImageView(MainApp.class.getResource("assets/static/icons/link.png").toString()));

    dialog.getDialogPane().getButtonTypes().addAll(ButtonType.OK, ButtonType.CANCEL);

    // Create the username and password labels and fields.
    GridPane grid = new GridPane();
    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(new Insets(20, 150, 10, 10));

    TextField tLink = new TextField();
    tLink.setText(link);
    TextField tLabel = new TextField();
    tLabel.setText(link);

    grid.add(new Label("Lien:"), 0, 0);
    grid.add(tLink, 1, 0);
    grid.add(new Label("Titre du lien"), 0, 1);
    grid.add(tLabel, 1, 1);

    dialog.getDialogPane().setContent(grid);

    // Request focus on the username field by default.
    Platform.runLater(tLink::requestFocus);

    // Convert the result to a username-password-pair when the login button
    // is clicked.
    dialog.setResultConverter(
        dialogButton -> {
          if (dialogButton == ButtonType.OK) {
            return new Pair<>(tLink.getText(), tLabel.getText());
          }
          return null;
        });

    Optional<Pair<String, String>> result = dialog.showAndWait();

    result.ifPresent(
        tLinkTLabel ->
            SourceText.replaceText(
                SourceText.getSelection(),
                "[" + tLinkTLabel.getValue() + "](" + tLinkTLabel.getKey() + ")"));

    SourceText.requestFocus();
  }
  public void initContent(GridPane pane) {
    // pane.setGridLinesVisible(true);
    pane.setPadding(new Insets(20));
    pane.setHgap(10);
    pane.setVgap(20);

    // header label
    Label lblHeader = new Label("Alert Dialogs");
    pane.add(lblHeader, 1, 0);
    lblHeader.setTextFill(Color.DARKBLUE);
    lblHeader.setFont(Font.font("Calibri", FontWeight.BOLD, 36));

    // label for input text field
    Label lblInput = new Label("A Text field:");
    pane.add(lblInput, 0, 1);
    lblInput.setFont(Font.font("Calibri", FontWeight.NORMAL, 20));

    // input text field
    this.txfInput = new TextField();
    pane.add(txfInput, 1, 1);
    this.txfInput.setMinHeight(30.0);
    this.txfInput.setPromptText("Enter some text and save.");

    // horizontal box for buttons
    HBox hbox = new HBox(20);
    pane.add(hbox, 1, 2);
    hbox.setAlignment(Pos.CENTER);

    // info button
    Button btnInfo = new Button("Info");
    btnInfo.setOnAction(event -> this.infoAction());
    hbox.getChildren().add(btnInfo);

    // save button
    Button btnSave = new Button("Save");
    btnSave.setOnAction(event -> this.saveAction());
    hbox.getChildren().add(btnSave);

    // clear button
    Button btnClear = new Button("Clear");
    btnClear.setOnAction(event -> this.clearAction());
    hbox.getChildren().add(btnClear);

    // status text
    this.txtStatus = new Text();
    pane.add(txtStatus, 0, 4, 3, 1);
    this.txtStatus.setFont(Font.font("Calibri", FontWeight.NORMAL, 20));
    this.txtStatus.setFill(Color.FIREBRICK);
    this.txtStatus.setText("An example of Alert Dialogs. Enter some text and save.");

    btnInfo.requestFocus();
  }
Beispiel #20
0
  @Override
  public Pane getVisSettings() {

    GridPane pane = new GridPane();
    pane.setPadding(new Insets(10, 0, 0, 0));
    pane.setHgap(5);
    pane.setVgap(5);

    // Dimension selection box
    ComboBox<String> dimCombo = new ComboBox<>();
    ObservableList<String> dimensions = FXCollections.observableArrayList();
    dimensions.add("X");
    dimensions.add("Y");
    dimensions.add("Z");
    dimCombo.setItems(dimensions);
    dimCombo.setValue(dimensions.get(2));
    dimCombo
        .valueProperty()
        .addListener(
            (ov, oldStr, newStr) -> {
              if (newStr.equals("X")) {
                renderer.setViewingDimension(0);
              } else if (newStr.equals("Y")) {
                renderer.setViewingDimension(1);
              } else {
                renderer.setViewingDimension(2);
              }
              renderer.render();
              Controller.getInstance().updateHistogram();
            });

    Label dimLabel = new Label();
    dimLabel.setText("Projection dimension: ");
    dimLabel.setLabelFor(dimCombo);

    pane.add(dimLabel, 0, 0);
    pane.add(dimCombo, 1, 0);

    // Scale checkbox
    CheckBox scaleBox = new CheckBox("Scale: ");
    scaleBox.setSelected(true);
    scaleBox
        .selectedProperty()
        .addListener(
            (ov, old_val, new_val) -> {
              renderer.setScaling(new_val);
              renderer.render();
            });
    pane.add(scaleBox, 0, 1);

    return pane;
  }
Beispiel #21
0
  private String showCreateOrRenameDialog(
      final String title,
      final String headerText,
      final File parent,
      final String name,
      final NameVerifier nameVerifier) {
    final Alert alert = new Alert(AlertType.CONFIRMATION);
    alert.setTitle(title);
    alert.setHeaderText(headerText);

    final GridPane contentContainer = new GridPane();
    contentContainer.setPadding(new Insets(8));
    contentContainer.setHgap(8);
    contentContainer.setVgap(8);

    contentContainer.add(new Label("Parent:"), 0, 0);
    final TextField parentTextField = new TextField();
    parentTextField.setEditable(false);

    parentTextField.setText(parent.getAbsolutePath());
    contentContainer.add(parentTextField, 1, 0);

    contentContainer.add(new Label("Name:"), 0, 1);

    final TextField dirNameTextField = new TextField();
    dirNameTextField.setText(name);
    GridPane.setHgrow(dirNameTextField, Priority.ALWAYS);
    contentContainer.add(dirNameTextField, 1, 1);

    final InvalidationListener updateDisableInvalidationListener =
        (observable) -> {
          final String dirName = dirNameTextField.getText();
          final Node okButton = alert.getDialogPane().lookupButton(ButtonType.OK);
          if (isEmpty(dirName)) okButton.setDisable(true);
          else {
            final boolean nameAcceptable = nameVerifier.isNameAcceptable(dirName);
            okButton.setDisable(!nameAcceptable);
          }
        };
    dirNameTextField.textProperty().addListener(updateDisableInvalidationListener);

    alert.getDialogPane().setContent(contentContainer);
    alert.setOnShowing(
        (event) -> {
          dirNameTextField.requestFocus();
          dirNameTextField.selectAll();
          updateDisableInvalidationListener.invalidated(null);
        });

    if (alert.showAndWait().get() == ButtonType.OK) return dirNameTextField.getText();
    else return null;
  }
  /**
   * Constructs base grid and its components for window.
   *
   * @return constructed grid with components
   */
  private GridPane addGridPane() {
    GridPane grid = new GridPane();
    grid.setPrefSize(400, 400);

    grid.setAlignment(Pos.CENTER);
    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(insets);

    addList(grid);

    return grid;
  }
Beispiel #23
0
  @Override
  public void start(Stage primaryStage) {

    GridPane root = new GridPane();
    root.setAlignment(Pos.CENTER);
    root.setHgap(10);
    root.setVgap(10);
    root.setPadding(new Insets(25, 25, 25, 25));
    Scene scene = new Scene(root, 1024, 768);

    primaryStage.setTitle("Plookify");
    primaryStage.setScene(scene);
    primaryStage.show();
  }
Beispiel #24
0
  public LabeledLayout() {
    node = new GridPane();

    ColumnConstraints column1 = new ColumnConstraints();
    column1.setHgrow(Priority.NEVER);
    ColumnConstraints column2 = new ColumnConstraints();
    column2.setHgrow(Priority.ALWAYS);
    column2.setHalignment(HPos.RIGHT);

    node.getColumnConstraints().addAll(column1, column2);

    node.setVgap(6);
    node.setHgap(6);
  }
Beispiel #25
0
  private static GridPane makeGridPane() {

    // all the widgets
    Text fText = new Text("Fahrenheit");
    Text cText = new Text("Celsius");
    TextField f = new TextField();
    TextField c = new TextField();
    Button f2c = new Button(">>>");
    Button c2f = new Button("<<<");

    GridPane gridPane = new GridPane();
    gridPane.add(fText, 0, 0);
    gridPane.add(f2c, 1, 0);
    gridPane.add(cText, 2, 0);
    gridPane.add(f, 0, 1);
    gridPane.add(c2f, 1, 1);
    gridPane.add(c, 2, 1);

    f.setPrefColumnCount(5);
    f.setPromptText("-40.0");
    c.setPrefColumnCount(5);
    c.setPromptText("-40.0");
    gridPane.setHgap(10);
    gridPane.setVgap(10);
    gridPane.setPadding(new Insets(10, 10, 10, 10));
    GridPane.setValignment(fText, VPos.BOTTOM);
    GridPane.setValignment(cText, VPos.BOTTOM);

    // event handling
    f2c.setOnAction(
        new EventHandler<ActionEvent>() {
          public void handle(ActionEvent e) {
            float fval = Float.valueOf(f.getText());
            float cval = (fval - 32) * 5 / 9;
            c.setText(String.format("%5.1f", cval));
          }
        });

    c2f.setOnAction(
        new EventHandler<ActionEvent>() {
          public void handle(ActionEvent e) {
            float cval = Float.valueOf(c.getText());
            float fval = cval * 9 / 5 + 32;
            f.setText(String.format("%5.1f", fval));
          }
        });

    return gridPane;
  }
Beispiel #26
0
  private GridPane getSubGrid() {
    subGrid = new GridPane();

    topPane = getTopPane();
    bottomPane = getBottomPane();

    topPane.setPadding(new Insets(50));
    bottomPane.setPadding(new Insets(50));
    subGrid.setPadding(new Insets(0, 100, 0, 100));

    // Css styling
    topPane.getStyleClass().add("TopPaneBorder");
    bottomPane.getStyleClass().add("TopPaneBorder");

    topTitleL.getStyleClass().add("topPaneTitle");
    bottomTitle.getStyleClass().add("topPaneTitle");

    bottomPane.setHgap(10);
    bottomPane.setVgap(5);
    bottomPane.setAlignment(Pos.CENTER_LEFT);

    topPane.setVgap(10);
    topPane.setHgap(10);
    topPane.setAlignment(Pos.CENTER);

    subGrid.setAlignment(Pos.CENTER);
    subGrid.setMargin(topPane, new Insets(10));
    subGrid.setMargin(bottomPane, new Insets(10));

    subGrid.setConstraints(topPane, 0, 1, 1, 1, HPos.CENTER, VPos.CENTER);
    subGrid.setConstraints(bottomPane, 0, 2, 1, 1, HPos.LEFT, VPos.CENTER);

    subGrid.getChildren().addAll(topPane, bottomPane);

    return subGrid;
  }
  @Override
  public void start(Stage primaryStage) {
    // primaryStage.initStyle(StageStyle.TRANSPARENT);
    accessor = new TwitchAPIAccessor();

    GridPane root = new GridPane();
    root.setHgap(20);
    root.setVgap(20);
    Button exit = new Button("Exit");
    exit.setOnAction(e -> primaryStage.close());
    root.add(exit, 0, 0);

    authStage = new Authentication();
    Button auth = new Button("Authenticate");
    auth.setOnAction(e -> authStage.authenticate(false, this::authSuccess, this::authFailure));
    root.add(auth, 0, 1);

    Button forceAuth = new Button("Force Authenticate");
    forceAuth.setOnAction(e -> authStage.authenticate(true, this::authSuccess, this::authFailure));
    root.add(forceAuth, 0, 2);

    Button isValid = new Button("Is Valid");
    isValid.setOnAction(e -> accessor.isOAuthValid(this::oauthValid, this::oauthInvalid));
    root.add(isValid, 0, 3);

    Button follows = new Button("Get Follows");
    follows.setOnAction(
        e -> accessor.getFollowAccessor().getUserStreamsFollowed(this::follows, this::exception));
    root.add(follows, 0, 4);

    ImageView imageView = new ImageView(image);
    imageView.setEffect(new ColorAdjust(0, -1, 0, 0));

    BorderPane imagePane = new BorderPane(imageView);
    imagePane.setStyle(
        "-fx-border-color: green;\n"
            + "-fx-border-insets: 5;\n"
            + "-fx-border-width:3;\n"
            + "-fx-border-style: dashed;\n");

    root.add(imagePane, 0, 5);

    Scene scene = new Scene(root);
    primaryStage.setScene(scene);
    primaryStage.show();
  }
 public SoapServiceVirtualUiMainPanel(
     final SoapServiceVirtualizeDto soap, final VirtualizationUiOptions wireMockOptions) {
   this.soap = soap;
   this.wireMockOptions = wireMockOptions;
   GridPane pane = new GridPane();
   pane.setAlignment(Pos.TOP_LEFT);
   pane.setHgap(10);
   pane.setVgap(10);
   setPadding(new Insets(5, 10, 5, 10));
   Label wsdlUrl = new Label("Wsdl URL:");
   Text requestXml = new Text("Request\nXml");
   requestXml.setTextAlignment(TextAlignment.JUSTIFY);
   Text responseXml = new Text("Response\nXml");
   responseXml.setTextAlignment(TextAlignment.JUSTIFY);
   loadWsdlButton = new MsstButton("LoadWsdl");
   wsdrlUrlTextField = new MsstTextField();
   wsdrlUrlTextField.setText(soap.getWsdlURL());
   GridPane.setHalignment(wsdrlUrlTextField, HPos.LEFT);
   Text endPointUrl = new Text("End point\nURL");
   operationList = new ComboBox<String>();
   serviceEndPointUrl = new MsstTextField();
   pane.add(wsdlUrl, 0, 1, 1, 1);
   pane.add(wsdrlUrlTextField, 1, 1, 5, 1);
   pane.add(loadWsdlButton, 6, 1, 2, 1);
   pane.add(endPointUrl, 0, 2);
   pane.add(serviceEndPointUrl, 1, 2, 5, 1);
   pane.add(operationList, 6, 2, 1, 1);
   saveButton = new MsstButton("Save Stub");
   requestTextArea = new MsstTextArea(soap.getRequestXml());
   responseTextArea = new MsstTextArea(soap.getResponseXml());
   requestTextArea.setMinWidth(300);
   responseTextArea.setMinWidth(300);
   GridPane.setHalignment(saveButton, HPos.CENTER);
   pane.add(requestXml, 0, 3, 1, 1);
   pane.add(requestTextArea, 1, 3, 2, 1);
   pane.add(responseXml, 3, 3, 1, 1);
   pane.add(responseTextArea, 4, 3, 3, 1);
   pane.add(saveButton, 0, 4, 5, 1);
   saveButton.setOnAction(saveButtonActionEvent);
   operationList.setOnAction(listActionListener);
   loadWsdlButton.setOnAction(loadWsdlActionListener);
   setFitToHeight(true);
   setFitToWidth(true);
   setContent(pane);
 }
  private void addLogin(final Stage primaryStage) {
    grid = new GridPane();
    btn = new Button();
    scenetitle = new Text("Welcome");
    userName = new Label("Name:");
    userTextField = new TextField();
    userTextField.setOnKeyPressed(
        new EventHandler<KeyEvent>() {

          @Override
          public void handle(KeyEvent event) {
            if (event.getCode().equals(KeyCode.ENTER)) {
              login(primaryStage);
            }
          }
        });

    btn.setText("Sign in");
    btn.setOnAction(
        new EventHandler<ActionEvent>() {

          @Override
          public void handle(ActionEvent event) {
            login(primaryStage);
          }
        });

    scenetitle.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));

    grid.setAlignment(Pos.CENTER);
    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(new Insets(25, 25, 25, 25));

    grid.add(scenetitle, 0, 0);
    grid.add(userName, 0, 1);
    grid.add(userTextField, 1, 1);
    grid.add(btn, 0, 2);

    Scene scene = new Scene(grid, 300, 275);
    primaryStage.setTitle("Chat Login");
    primaryStage.setScene(scene);
    primaryStage.show();
  }
  private GridPane buildRecordingGrid(Recording recording) {
    GridPane grid = new GridPane();
    grid.setHgap(5);
    grid.setVgap(5);

    Label status = new Label();
    status.setAlignment(Pos.CENTER);
    status.setMinWidth(STATUS_MIN_WIDTH);
    updateStatusIcon(recording, status);
    recording
        .fileExistsActionProperty()
        .addListener(observable -> updateStatusIcon(recording, status));

    Label title = new Label();
    title.setMinWidth(TITLE_MIN_WIDTH);
    title.textProperty().bind(recording.fullTitleProperty());

    Label destination = new Label();
    destination.getStyleClass().add("destination");
    destination.textProperty().bind(recording.destinationProperty().asString());
    LocalDate dateArchived = recording.getDateArchived();
    if (dateArchived != null) {
      String dateArchivedText =
          String.format("Archived %s", DateUtils.formatArchivedOnDate(dateArchived));
      Tooltip tooltip = new Tooltip(dateArchivedText);
      title.setTooltip(tooltip);
      destination.setTooltip(tooltip);
    }

    ReplaceOrRenameActionBar actionBar = new ReplaceOrRenameActionBar(recording, userPrefs);
    actionBar.setMinWidth(ACTION_BAR_MIN_WIDTH);
    GridPane.setHalignment(actionBar, HPos.RIGHT);
    GridPane.setHgrow(actionBar, Priority.ALWAYS);
    GridPane.setMargin(actionBar, new Insets(0, 0, 0, 10));

    grid.add(status, 0, 0, 1, 2);
    grid.add(title, 1, 0);
    grid.add(destination, 1, 1);
    grid.add(actionBar, 2, 0, 1, 2);

    return grid;
  }