Ejemplo n.º 1
0
  private HBox initGUIcenterRechtsZeile1() {
    HBox zeile = new HBox(10);

    Label id = new Label("");
    RahmenTitelWeiss rahmenId = new RahmenTitelWeiss("ID", id);

    TextField projektbezeichnung1 = new TextField();
    projektbezeichnung1.setPrefColumnCount(15);
    projektbezeichnung1.setEditable(false);
    RahmenTitelWeiss rahmenProjektbezeichnung1 =
        new RahmenTitelWeiss("Projektbezeichnung 1", projektbezeichnung1);

    TextField projektbezeichnung2 = new TextField();
    projektbezeichnung2.setPrefColumnCount(15);
    projektbezeichnung2.setEditable(false);
    RahmenTitelWeiss rahmenProjektbezeichnung2 =
        new RahmenTitelWeiss("Projektbezeichnung 2", projektbezeichnung2);

    TextField status = new TextField();
    status.setEditable(false);
    status.setMinWidth(200);
    RahmenTitelWeiss rahmenStatus = new RahmenTitelWeiss("Status", status);

    zeile.getChildren().add(rahmenId);
    zeile.getChildren().add(rahmenProjektbezeichnung1);
    zeile.getChildren().add(rahmenProjektbezeichnung2);
    zeile.getChildren().add(rahmenStatus);
    return zeile;
  }
Ejemplo n.º 2
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;
  }
Ejemplo n.º 3
0
  private VBox LeftArea() {
    System.out.println("Gui.leftarea()");
    VBox leftArea = new VBox();

    input = new TextField();
    this.rawExile = new TextArea();
    input.setPrefColumnCount(88);
    rawExile.setPrefColumnCount(88);
    rawExile.setPrefHeight(1530);
    input.setPrefHeight(50);
    input.setOnKeyReleased(
        new EventHandler<KeyEvent>() {
          @Override
          public void handle(KeyEvent keyEvent) {
            if (keyEvent.getCode() == KeyCode.ENTER) {
              try {
                et.getOutputStream()
                    .write(input.getText().getBytes(), 0, input.getText().getBytes().length);
                et.getOutputStream().flush();
                input.setText("");
              } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
              }
            }
          }
        });
    leftArea.getChildren().add(rawExile);
    leftArea.getChildren().add(input);
    return leftArea;
  }
Ejemplo n.º 4
0
 PortPane() {
   label = new Label("Willkommen!\n" + "Bitte Port eingeben:");
   label.setFont(Font.font("Comic sans MS", 20));
   this.add(label, 0, 0, 2, 1);
   Label portLabel = new Label("Port:");
   this.add(portLabel, 0, 1);
   textField = new TextField("24242");
   textField.setPrefColumnCount(5);
   textField
       .lengthProperty()
       .addListener(
           new ChangeListener<Number>() {
             @Override
             public void changed(
                 ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
               if (newValue.intValue() > 5) textField.setText(textField.getText(0, 5));
               else if (newValue.intValue() > oldValue.intValue()) {
                 char ch = textField.getText().charAt(oldValue.intValue());
                 if (!(ch >= '0' && ch <= '9')) {
                   textField.setText(
                       textField.getText().substring(0, textField.getText().length() - 1));
                 }
               }
             }
           });
   this.add(textField, 1, 1);
   final Button button = new Button("Fertig!");
   HBox hBox = new HBox(10);
   hBox.getChildren().add(button);
   hBox.setAlignment(Pos.BOTTOM_RIGHT);
   this.add(hBox, 1, 2);
   this.setHgap(10);
   this.setVgap(10);
   this.setPadding(new Insets(30, 30, 30, 30));
   this.setAlignment(Pos.CENTER);
   textField.setOnAction(
       new EventHandler<ActionEvent>() {
         @Override
         public void handle(ActionEvent actionEvent) {
           button.requestFocus();
         }
       });
   button.setOnAction(
       new EventHandler<ActionEvent>() {
         @Override
         public void handle(ActionEvent actionEvent) {
           if (!Main.createPortListener(Integer.parseInt(textField.getText()))) {
             Main.rootPane.setPorteingabe();
             setFailure(Integer.parseInt(textField.getText()));
           }
         }
       });
 }
Ejemplo n.º 5
0
  private HBox initGUIcenterRechtsZeile5() {
    HBox zeile = new HBox(10);

    TextField email = new TextField();
    email.setPrefColumnCount(21);
    email.setEditable(false);
    RahmenTitelWeiss rahmenEmail = new RahmenTitelWeiss("Email", email);

    Button knopfEmail = new Button("Email");

    TextField homepage = new TextField();
    homepage.setPrefColumnCount(21);
    homepage.setEditable(false);
    RahmenTitelWeiss rahmenHomepage = new RahmenTitelWeiss("Homepage", homepage);

    Button knopfWeb = new Button("Web");

    zeile.getChildren().add(rahmenEmail);
    zeile.getChildren().add(knopfEmail);
    zeile.getChildren().add(rahmenHomepage);
    zeile.getChildren().add(knopfWeb);
    return zeile;
  }
  public FileViewerPane() {

    // Top border pane custom settings
    HBox topPane = new HBox(10, lblFilePath, tfFilePath);
    topPane.setPadding(new Insets(10));
    topPane.setAlignment(Pos.BASELINE_LEFT);

    // Bottom border pane custom settings
    HBox bottomPane = new HBox(btnSave);
    bottomPane.setAlignment(Pos.BASELINE_CENTER);
    bottomPane.setPadding(new Insets(10));

    // Member nodes custom settings
    tfFilePath.setPrefColumnCount(32);
    taContent.setWrapText(true);

    // Adding panes to borderPane
    setTop(topPane);
    setCenter(new ScrollPane(taContent));
    setBottom(bottomPane);
  }
Ejemplo n.º 7
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;
  }
Ejemplo n.º 8
0
  /**
   * Creates popup menu based on menu button selected
   *
   * @param type type of menu button selected
   */
  @SuppressWarnings({"unchecked", "rawtypes"})
  private void genericPopup(String type) {

    int length = 0;
    int width = 0;
    String title = new String();
    Stage secondaryStage = new Stage();

    // Create a GridPane container
    GridPane grid = new GridPane();
    grid.setPadding(new Insets(10, 10, 10, 10));
    grid.setVgap(5);
    grid.setHgap(5);
    Button submit = new Button("Submit");
    GridPane.setConstraints(submit, 1, 0);
    grid.getChildren().add(submit);

    if (type.equals("customer")) {
      final TextField name = new TextField();
      name.setPrefColumnCount(17);
      GridPane.setConstraints(name, 0, 0);
      grid.getChildren().add(name);

      submit.setOnAction(
          new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
              if (!name.getText().isEmpty()) {
                if (myController.getRestClient().selectCustomer(name.getText(), name)) {
                  secondaryStage.close();
                }
              } else {
                name.setPromptText("Enter customer username.");
              }
              updateAccountsWindow();
            }
          });
      length = 50;
      width = 285;
      title = "Select Customer";
    } else if (type.equals("create")) {
      final ComboBox accountTypeCB = new ComboBox();
      accountTypeCB
          .getItems()
          .addAll("SELECT TYPE", "CHECKING", "SAVINGS", "MONEY MARKET", "MORTGAGE", "CREDIT");
      accountTypeCB.setValue("SELECT TYPE");

      GridPane.setConstraints(accountTypeCB, 0, 0);
      grid.getChildren().add(accountTypeCB);

      submit.setOnAction(
          new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
              if (accountTypeCB.getValue().toString().equals("SELECT TYPE")) {
                accountTypeCB.setValue("SELECT TYPE");
              } else {
                Account.TYPE thisType = Account.TYPE.CHECKING;
                if (accountTypeCB.getValue().toString().equals("SAVINGS")) {
                  thisType = Account.TYPE.SAVINGS;
                } else if (accountTypeCB.getValue().toString().equals("MONEY MARKET")) {
                  thisType = Account.TYPE.MONEY_MARKET;
                } else if (accountTypeCB.getValue().toString().equals("MORTGAGE")) {
                  thisType = Account.TYPE.MORTGAGE;
                } else if (accountTypeCB.getValue().toString().equals("CREDIT")) {
                  thisType = Account.TYPE.CREDIT;
                }

                if (myController.getRestClient().addAccount(thisType, 0.0f, 0.0f)) {
                  secondaryStage.close();
                } else {
                  accountTypeCB.setValue("SELECT TYPE");
                }
              }
              updateAccountsWindow();
            }
          });

      length = 50;
      width = 285;
      title = "Create Account";

    } else if (type.equals("delete")) {
      final ComboBox accountsCB = new ComboBox();
      if (myController.getRestClient().getUserAccounts() != null) {
        Iterator it = myController.getRestClient().getUserAccounts().entrySet().iterator();
        while (it.hasNext()) {
          Map.Entry me = (Map.Entry) it.next();
          accountsCB.getItems().add(me.getKey());
        }
      }
      accountsCB.setValue("SELECT ACCOUNT");

      GridPane.setConstraints(accountsCB, 0, 0);
      grid.getChildren().add(accountsCB);

      submit.setOnAction(
          new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
              if (accountsCB.getValue().equals("SELECT ACCOUNT")) {
                accountsCB.setValue("SELECT ACCOUNT");
              } else {
                if (myController.getRestClient().deleteAccount((int) accountsCB.getValue())) {
                  secondaryStage.close();
                } else {
                  accountsCB.setValue("SELECT ACCOUNT");
                }
              }
              updateAccountsWindow();
            }
          });

      length = 50;
      width = 285;
      title = "Delete Account";

    } else if (type.equals("deposit")) {
      final ComboBox accountsCB = new ComboBox();
      final TextField amount = new TextField();
      amount.setPrefColumnCount(10);
      amount.setPromptText("Deposit Amount");
      if (myController.getRestClient().getUserAccounts() != null) {
        Iterator it = myController.getRestClient().getUserAccounts().entrySet().iterator();
        while (it.hasNext()) {
          Map.Entry me = (Map.Entry) it.next();
          accountsCB.getItems().add(me.getKey());
        }
      }
      accountsCB.setValue("SELECT ACCOUNT");

      GridPane.setConstraints(accountsCB, 0, 0);
      grid.getChildren().add(accountsCB);
      GridPane.setConstraints(amount, 0, 1);
      grid.getChildren().add(amount);
      submit.setOnAction(
          new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
              if (accountsCB.getValue().equals("SELECT ACCOUNT")) {
                accountsCB.setValue("SELECT ACCOUNT");
              } else if (!accountsCB.getValue().equals("SELECT ACCOUNT")
                  && !amount.getText().isEmpty()) {

                if (myController
                    .getRestClient()
                    .makeDeposit((int) accountsCB.getValue(), Float.valueOf(amount.getText()))) {
                  secondaryStage.close();
                } else {
                  accountsCB.setValue("SELECT ACCOUNT");
                  amount.setPromptText("Deposit Amount");
                }

              } else {
                accountsCB.setValue("SELECT ACCOUNT");
                amount.setPromptText("Deposit Amount");
              }
              updateAccountsWindow();
            }
          });

      length = 100;
      width = 285;
      title = "Make Deposit";
    } else if (type.equals("withdraw")) {
      final ComboBox accountsCB = new ComboBox();
      final TextField amount = new TextField();
      amount.setPrefColumnCount(10);
      amount.setPromptText("Withdraw Amount");
      if (myController.getRestClient().getUserAccounts() != null) {
        Iterator it = myController.getRestClient().getUserAccounts().entrySet().iterator();
        while (it.hasNext()) {
          Map.Entry me = (Map.Entry) it.next();
          accountsCB.getItems().add(me.getKey());
        }
      }
      accountsCB.setValue("SELECT ACCOUNT");

      GridPane.setConstraints(accountsCB, 0, 0);
      grid.getChildren().add(accountsCB);
      GridPane.setConstraints(amount, 0, 1);
      grid.getChildren().add(amount);
      submit.setOnAction(
          new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
              if (accountsCB.getValue().equals("SELECT ACCOUNT")) {
                accountsCB.setValue("SELECT ACCOUNT");
              } else if (!accountsCB.getValue().equals("SELECT ACCOUNT")
                  && !amount.getText().isEmpty()) {

                if (myController
                    .getRestClient()
                    .makeWithdrawal((int) accountsCB.getValue(), Float.valueOf(amount.getText()))) {
                  secondaryStage.close();
                } else {
                  accountsCB.setValue("SELECT ACCOUNT");
                  amount.setPromptText("Withdraw Amount");
                }
              } else {
                accountsCB.setValue("SELECT ACCOUNT");
                amount.setPromptText("Withdraw Amount");
              }
              updateAccountsWindow();
            }
          });

      length = 100;
      width = 285;
      title = "Make Deposit";
    } else if (type.equals("transfer")) {
      final ComboBox srcAccountsCB = new ComboBox();
      final ComboBox dstAccountsCB = new ComboBox();
      final TextField amount = new TextField();
      amount.setPrefColumnCount(10);
      amount.setPromptText("Transfer Amount");
      if (myController.getRestClient().getUserAccounts() != null) {
        Iterator it = myController.getRestClient().getUserAccounts().entrySet().iterator();
        while (it.hasNext()) {
          Map.Entry me = (Map.Entry) it.next();
          srcAccountsCB.getItems().add(me.getKey());
          dstAccountsCB.getItems().add(me.getKey());
        }
      }
      srcAccountsCB.setValue("SELECT FROM ACCOUNT");
      dstAccountsCB.setValue("SELECT TO ACCOUNT");

      GridPane.setConstraints(srcAccountsCB, 0, 0);
      GridPane.setConstraints(srcAccountsCB, 0, 1);
      GridPane.setConstraints(amount, 0, 2);
      grid.getChildren().add(srcAccountsCB);
      grid.getChildren().add(dstAccountsCB);
      grid.getChildren().add(amount);
      submit.setOnAction(
          new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
              if (srcAccountsCB.getValue().equals("SELECT FROM ACCOUNT")) {
                srcAccountsCB.setValue("SELECT FROM ACCOUNT");
              } else if (dstAccountsCB.getValue().equals("SELECT TO ACCOUNT")) {
                dstAccountsCB.setValue("SELECT TO ACCOUNT");
              } else if (!srcAccountsCB.getValue().equals("SELECT FROM ACCOUNT")
                  && !dstAccountsCB.getValue().equals("SELECT TO ACCOUNT")
                  && !amount.getText().isEmpty()) {

                if (myController
                    .getRestClient()
                    .makeTransfer(
                        (int) srcAccountsCB.getValue(),
                        (int) dstAccountsCB.getValue(),
                        Float.valueOf(amount.getText()))) {
                  secondaryStage.close();
                } else {
                  srcAccountsCB.setValue("SELECT FROM ACCOUNT");
                  dstAccountsCB.setValue("SELECT TO ACCOUNT");
                  amount.setPromptText("Transfer Amount");
                }
              } else {
                srcAccountsCB.setValue("SELECT FROM ACCOUNT");
                dstAccountsCB.setValue("SELECT TO ACCOUNT");
                amount.setPromptText("Transfer Amount");
              }
              updateAccountsWindow();
            }
          });

      length = 125;
      width = 285;
      title = "Transfer Funds";
    } else if (type.equals("transaction")) {
      final ComboBox accountsCB = new ComboBox();
      if (myController.getRestClient().getUserAccounts() != null) {
        Iterator it = myController.getRestClient().getUserAccounts().entrySet().iterator();
        while (it.hasNext()) {
          Map.Entry me = (Map.Entry) it.next();
          accountsCB.getItems().add(me.getKey());
        }
      }
      accountsCB.setValue("SELECT ACCOUNT");

      GridPane.setConstraints(accountsCB, 0, 0);
      grid.getChildren().add(accountsCB);
      submit.setOnAction(
          new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
              if (accountsCB.getValue().equals("SELECT ACCOUNT")) {
                accountsCB.setValue("SELECT ACCOUNT");
              } else if (!accountsCB.getValue().equals("SELECT ACCOUNT")) {

                if (myController.getRestClient().getUserAccounts() != null) {
                  Iterator it =
                      myController.getRestClient().getUserAccounts().entrySet().iterator();
                  while (it.hasNext()) {
                    Map.Entry me = (Map.Entry) it.next();
                    if (accountsCB.getSelectionModel().getSelectedItem() == me.getKey()) {
                      updateTransactionWindow((Account) me.getValue());
                    }
                  }
                  secondaryStage.close();
                } else {
                  accountsCB.setValue("SELECT ACCOUNT");
                }

              } else {
                accountsCB.setValue("SELECT ACCOUNT");
              }
              updateAccountsWindow();
            }
          });

      length = 100;
      width = 285;
      title = "View Transactions";
    }

    Scene scene = new Scene(grid, width, length);
    secondaryStage.setScene(scene);
    secondaryStage.setTitle(title);
    secondaryStage.show();
  }
Ejemplo n.º 9
0
  // Override the start() method.
  public void start(Stage myStage) {

    // Give the stage a title.
    myStage.setTitle("Demonstrate a TextField");

    // Use a FlowPane for the root node. In this case,
    // vertical and horizontal gaps of 10.
    FlowPane rootNode = new FlowPane(10, 10);

    // Center the controls in the scene.
    rootNode.setAlignment(Pos.CENTER);

    // Create a scene.
    Scene myScene = new Scene(rootNode, 230, 140);

    // Set the scene on the stage.
    myStage.setScene(myScene);

    // Create a label that will report the state of the
    // selected checkbox.
    response = new Label("Search String: ");

    // Create a button that gets the text.
    Button btnGetText = new Button("Get Search String");

    // Create a text field
    tf = new TextField();

    // Set the prompt.
    tf.setPromptText("Enter Search String");

    // Set preferred column count.
    tf.setPrefColumnCount(15);

    // Handle action events for the text field. Action
    // events are generated when ENTER is pressed while
    // the textfield has input focus. In this case, the
    // text in the field is obtained and displayed.
    tf.setOnAction(
        new EventHandler<ActionEvent>() {
          public void handle(ActionEvent ae) {
            response.setText("Search String: " + tf.getText());
          }
        });

    // Get text from the text field when the button is pressed
    // and display it.
    btnGetText.setOnAction(
        new EventHandler<ActionEvent>() {
          public void handle(ActionEvent ae) {
            response.setText("Search String: " + tf.getText());
          }
        });

    // Use a separator to better organize the layout.
    Separator separator = new Separator();
    separator.setPrefWidth(180);

    // Add controls to the scene graph.
    rootNode.getChildren().addAll(tf, btnGetText, separator, response);

    // Show the stage and its scene.
    myStage.show();
  }