private TextField joinButtonToTextField() {
   buttonContainer.getChildren().remove(joinButton);
   TextField ipTextField = new TextField();
   ipTextField.setPrefSize(200, 35);
   ipTextField.setMaxWidth(200);
   ipTextField.setAlignment(Pos.CENTER);
   buttonContainer.getChildren().add(ipTextField);
   ipTextField.requestFocus();
   return ipTextField;
 }
 private TextField nameButtonToTextField() {
   buttonContainer.getChildren().remove(nameButton);
   TextField editNameTextField = new TextField();
   editNameTextField.setPrefSize(200, 20);
   editNameTextField.setMaxWidth(200);
   editNameTextField.setAlignment(Pos.TOP_CENTER);
   buttonContainer.getChildren().add(0, editNameTextField);
   editNameTextField.requestFocus();
   return editNameTextField;
 }
Example #3
0
 /** Creates the editor */
 private void createTextField() {
   textField = new TextField(getString());
   textField.setMinWidth(this.getWidth() - this.getGraphicTextGap() * 2);
   textField.setAlignment(getAlignment());
   textField.setOnKeyPressed(
       new EventHandler<KeyEvent>() {
         @Override
         public void handle(KeyEvent t) {
           if (t.getCode() == KeyCode.ENTER) {
             commitIfValid(textField.getText());
           } else if (t.getCode() == KeyCode.ESCAPE) {
             cancelEdit();
           }
         }
       });
 }
  @Override // Override the getPane() method in the super class
  protected BorderPane getPane() {
    BorderPane pane = super.getPane();

    BorderPane paneForTextField = new BorderPane();
    paneForTextField.setPadding(new Insets(5, 5, 5, 5));
    paneForTextField.setStyle("-fx-border-color: green");
    paneForTextField.setLeft(new Label("Enter a new message: "));

    TextField tf = new TextField();
    tf.setAlignment(Pos.BOTTOM_RIGHT);
    tf.setPrefWidth(100);
    tf.setPrefHeight(100);
    paneForTextField.setCenter(tf);
    pane.setTop(paneForTextField);

    tf.setOnAction(e -> text.setText(tf.getText()));

    return pane;
  }
Example #5
0
  private GridPane getTopPane() {
    topPane = new GridPane();

    // Top pane
    Label DateL = new Label("Date");
    Label surveyDateL = new Label("Surveyed Date");
    Label NameL = new Label("Name");
    Label spouseNameL = new Label("Spouse Name");
    Label addressL = new Label("Address");
    Label ageL = new Label("Age");
    Label yearofResidencyL = new Label("Year of Residency");
    Label numofChildrenL = new Label("Number of Children");

    // search nodes declaration

    // topPane nodes declaration
    dateField = new TextField(Utility.getCurrentDate());

    datePicker = new DatePicker();
    Name = new TextField();
    SpouseName = new TextField();
    agefield = new TextField();
    addressF = new TextField();
    yrResidency = new TextField();
    numofChildrenF = new TextField();

    // nodes initialization
    dateField.setAlignment(Pos.CENTER);
    dateField.setDisable(true);
    numofChildrenF.setText("0");

    Name.setPromptText("First Name");
    LastName.setPromptText("Last Name");
    MidlleName.setPromptText("Middle Name");

    SpouseName.setPromptText("Spouse Full Name");
    agefield.setPromptText("35");
    addressF.setPromptText("e.g 12345 Manga st. Mabalacat");
    yrResidency.setPromptText("e.g 2012");
    numofChildrenF.setPromptText("Number of children");

    SpouseName.setDisable(true);

    maritalCBox = new ComboBox(getMaritalStatus());
    barangayCb = new ComboBox(getBarangayListModel());
    genderCB = new ComboBox(getGender());

    maritalCBox.setPrefWidth(140);
    maritalCBox.setPromptText("Marital Status");
    maritalCBox.setEditable(false);

    genderCB.setPromptText("Gender");
    genderCB.setPrefWidth(140);

    barangayCb.setPromptText("Barangay");
    barangayCb.setEditable(false);

    // --------------------- Layouting ----------------------------///

    int indexYTop = 0;

    topPane.setConstraints(topTitleL, 0, indexYTop, 1, 1, HPos.LEFT, VPos.TOP);

    indexYTop++;
    topPane.setConstraints(DateL, 0, indexYTop, 1, 1, HPos.LEFT, VPos.CENTER);
    topPane.setConstraints(dateField, 1, indexYTop, 1, 1, HPos.CENTER, VPos.CENTER);
    topPane.setConstraints(barangayCb, 5, indexYTop, 1, 1, HPos.CENTER, VPos.CENTER);

    indexYTop++;

    topPane.setConstraints(surveyDateL, 0, indexYTop, 1, 1, HPos.LEFT, VPos.CENTER);
    topPane.setConstraints(datePicker, 1, indexYTop, 1, 1, HPos.CENTER, VPos.CENTER);
    bottomPane.setConstraints(maritalCBox, 5, indexYTop, 1, 1, HPos.CENTER, VPos.CENTER);

    indexYTop++;
    bottomPane.setConstraints(yearofResidencyL, 0, indexYTop, 1, 1, HPos.LEFT, VPos.CENTER);
    bottomPane.setConstraints(yrResidency, 1, indexYTop, 1, 1, HPos.LEFT, VPos.CENTER);
    bottomPane.setConstraints(genderCB, 5, indexYTop, 1, 1, HPos.CENTER, VPos.CENTER);

    indexYTop++;
    bottomPane.setConstraints(numofChildrenL, 0, indexYTop, 1, 1, HPos.LEFT, VPos.CENTER);
    bottomPane.setConstraints(numofChildrenF, 1, indexYTop, 1, 1, HPos.LEFT, VPos.CENTER);
    topPane.setConstraints(ageL, 4, indexYTop, 1, 1, HPos.RIGHT, VPos.CENTER);
    topPane.setConstraints(agefield, 5, indexYTop, 1, 1, HPos.CENTER, VPos.CENTER);

    indexYTop++;
    topPane.setConstraints(NameL, 0, indexYTop, 1, 1, HPos.LEFT, VPos.CENTER);
    topPane.setConstraints(Name, 1, indexYTop, 3, 1, HPos.CENTER, VPos.CENTER);
    topPane.setConstraints(LastName, 4, indexYTop, 1, 1, HPos.CENTER, VPos.CENTER);
    topPane.setConstraints(MidlleName, 5, indexYTop, 1, 1, HPos.CENTER, VPos.CENTER);

    indexYTop++;
    topPane.setConstraints(spouseNameL, 0, indexYTop, 1, 1, HPos.LEFT, VPos.CENTER);
    topPane.setConstraints(SpouseName, 1, indexYTop, 5, 1, HPos.CENTER, VPos.CENTER);

    indexYTop++;
    topPane.setConstraints(addressL, 0, indexYTop, 1, 1, HPos.LEFT, VPos.CENTER);
    topPane.setConstraints(addressF, 1, indexYTop, 5, 1, HPos.CENTER, VPos.CENTER);

    dateField.setPrefColumnCount(6);
    agefield.setPrefColumnCount(6);

    // adding nodes to the top gridpane
    topPane
        .getChildren()
        .addAll(
            topTitleL,
            DateL,
            dateField,
            surveyDateL,
            datePicker,
            barangayCb,
            yearofResidencyL,
            yrResidency,
            maritalCBox,
            numofChildrenL,
            numofChildrenF,
            genderCB,
            NameL,
            Name,
            LastName,
            MidlleName,
            ageL,
            agefield,
            spouseNameL,
            SpouseName,
            addressL,
            addressF);

    addTopComponentListeners();

    return topPane;
  }
  public Veld1RijtechniekKijktechniek(
      SchermController schermCtrl, EvaController evaCtrl, LeerlingController llnCtrl) {
    evaController = evaCtrl;
    schermController = schermCtrl;
    llnController = llnCtrl;

    this.llnController.getLeerling().addView(this);

    aandachtBtn = new Button("Aandachtspunt");
    aandachtBtn.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent e) {
            aandacht();
          }
        });

    commentaarCol = new TableColumn("Commentaar");
    commentaarCol.setCellValueFactory(new PropertyValueFactory<Rijtechniek, String>("commentaar"));
    commentaarCol.setCellFactory(TextFieldTableCell.forTableColumn());
    commentaarCol.setOnEditCommit(
        new EventHandler<CellEditEvent<Rijtechniek, String>>() {
          @Override
          public void handle(CellEditEvent<Rijtechniek, String> t) {
            ((Rijtechniek) t.getTableView().getItems().get(t.getTablePosition().getRow()))
                .setCommentaar(t.getNewValue());
          }
        });

    table.setItems(data);
    table.getColumns().addAll(commentaarCol);

    commentaarFld = new TextField();
    commentaarFld.setPromptText("Commentaar");

    addButton = new Button("Voeg toe");
    addButton.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent e) {
            resetAandachtBtn();
            if (!"".equals(commentaarFld.getText())) {
              data.add(new Rijtechniek(commentaarFld.getText()));
              commentaarFld.clear();
            }
          }
        });
    table.setItems(data);
    table.setOnMouseClicked(
        new EventHandler<MouseEvent>() {
          @Override
          public void handle(MouseEvent e) {
            resetAandachtBtn();
          }
        });
    table.setEditable(true);

    vBox2.getChildren().addAll(table, commentaarFld);
    exit = new Button("Ga terug");

    exit.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent e) {
            evaController.saveListDataRijtechniek("Stuurtechniek", data);
            Veld1RijtechniekKijktechniek.this.schermController.setScherm(MainApp.RIJTECHNIEK_ID);
            resetAandachtBtn();
          }
        });
    delBtn = new Button("Verwijder");
    delBtn.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent e) {
            resetAandachtBtn();

            table.getItems().remove(table.getSelectionModel().getSelectedItem());
          }
        });
    delBtn.setMinHeight(30);
    delBtn.setMaxHeight(30);
    delBtn.setMinWidth(125);
    delBtn.setMaxWidth(125);
    delBtn.setAlignment(Pos.CENTER);
    delBtn.setTranslateX(-47);
    delBtn.setStyle("-fx-background-color: #5F6A95; -fx-text-fill:white");
    table.getStylesheets().add("resource/tableView.css");
    commentaarFld.setStyle("-fx-background-color:#789EBF; -fx-text-fill:white");
    commentaarCol.setMaxWidth(496);
    commentaarCol.setMinWidth(496);
    hBox1.getChildren().addAll(titelAfb, titel);
    hBox1.setMinHeight(50);
    hBox1.setMaxHeight(50);
    hBox1.setMinWidth(600);
    hBox1.setMaxWidth(600);
    hBox1.setSpacing(15);
    hBox1.setAlignment(Pos.CENTER);
    titelAfb.setFitHeight(50);
    titelAfb.setFitWidth(50);
    titel.setStyle("-fx-font: 40px Tahoma; -fx-text-fill:white");

    table.setMinWidth(500);
    table.setMaxWidth(500);
    table.setMinHeight(400);
    table.setMaxHeight(400);
    addButton.setMinHeight(30);
    addButton.setMaxHeight(30);
    addButton.setMinWidth(150);
    addButton.setMaxWidth(150);
    addButton.setAlignment(Pos.CENTER);
    aandachtBtn.setMinHeight(30);
    aandachtBtn.setMaxHeight(30);
    aandachtBtn.setMinWidth(150);
    aandachtBtn.setMaxWidth(150);
    aandachtBtn.setAlignment(Pos.CENTER);
    exit.setMinHeight(30);
    exit.setMaxHeight(30);
    exit.setMinWidth(150);
    exit.setMaxWidth(150);
    exit.setAlignment(Pos.CENTER);
    commentaarFld.setMinHeight(30);
    commentaarFld.setMaxHeight(30);
    commentaarFld.setMinWidth(250);
    commentaarFld.setMaxWidth(250);
    commentaarFld.setAlignment(Pos.CENTER);
    table.setTranslateX(70);
    commentaarFld.setTranslateX(90);
    addButton.setTranslateX(90);
    aandachtBtn.setTranslateX(90);
    exit.setTranslateX(90);

    addButton.setStyle("-fx-background-color: #5F6A95; -fx-text-fill:white");
    exit.setStyle("-fx-background-color: #5F6A95; -fx-text-fill:white");
    aandachtBtn.setStyle("-fx-background-color: #5F6A95; -fx-text-fill:white");

    gp.setStyle(
        "-fx-border-color: #282E54; -fx-border-radius:10 10 10 10;"
            + "-fx-effect: dropshadow(three-pass-box, rgba(0,0,0,0.8), 10, 0, 0, 0);"
            + "-fx-background-color: #282B3A;"
            + "-fx-background-radius: 5;");
    gp.setMaxWidth(900);
    gp.setMinWidth(900);
    gp.setMinHeight(600);
    gp.setMaxHeight(600);
    gp.setHgap(50);
    gp.setVgap(20);
    gp.setAlignment(Pos.CENTER);
    gp.add(hBox1, 0, 0, 2, 1);
    gp.add(table, 0, 1, 2, 1);
    gp.add(commentaarFld, 0, 2);
    gp.add(addButton, 1, 2);
    gp.add(aandachtBtn, 0, 3);
    gp.add(exit, 1, 3);
    gp.add(delBtn, 1, 3);

    this.setAlignment(Pos.CENTER);
    this.getChildren().add(gp);
    this.setStyle("-fx-background-image: url('resource/achtergrondStandaard.png')");

    update();
  }