Package javafx.scene.control

Examples of javafx.scene.control.PasswordField


    if (type == Type.PASSWORD) {
      textField = null;
      textArea = null;
      numericStepperDigits = null;
      listView = null;
      passwordField = new PasswordField();
      passwordField.setPromptText(labelText);
      if (width != null) {
        passwordField.setPrefWidth(width.doubleValue());
      }
      if (height != null) {
View Full Code Here


      sl.setSnapToTicks(true);
      // POJO binding magic...
      personPA.bindBidirectional(path, sl.valueProperty());
      ctrl = sl;
    } else if (controlType == PasswordField.class) {
      final PasswordField tf = new PasswordField() {
        @Override
        public void replaceText(int start, int end, String text) {
          if (matchTest(text)) {
            super.replaceText(start, end, text);
          }
        }

        @Override
        public void replaceSelection(String text) {
          if (matchTest(text)) {
            super.replaceSelection(text);
          }
        }

        private boolean matchTest(String text) {
          return text.isEmpty()
              || (text.matches(restictTo) && (getText() == null || getText()
                  .length() < maxChars));
        }
      };
      // POJO binding magic...
      personPA.bindBidirectional(path, tf.textProperty());
      ctrl = tf;
    } else {
      final TextField tf = controlType == PasswordField.class ? new PasswordField() {
        @Override
        public void replaceText(int start, int end, String text) {
          if (matchTest(text)) {
            super.replaceText(start, end, text);
          }
        }

        @Override
        public void replaceSelection(String text) {
          if (matchTest(text)) {
            super.replaceSelection(text);
          }
        }

        private boolean matchTest(String text) {
          return text.isEmpty()
              || (text.matches(restictTo) && (getText() == null || getText()
                  .length() < maxChars));
        }
      }
          : new TextField() {
            @Override
            public void replaceText(int start, int end, String text) {
              if (matchTest(text)) {
                super.replaceText(start, end, text);
              }
            }

            @Override
            public void replaceSelection(String text) {
              if (matchTest(text)) {
                super.replaceSelection(text);
              }
            }

            private boolean matchTest(String text) {
              return text.isEmpty()
                  || (text.matches(restictTo) && (getText() == null || getText()
                      .length() < maxChars));
            }
          };
      // POJO binding magic...
      personPA.bindBidirectional(path, tf.textProperty());
      ctrl = tf;
    }
    box.getChildren()
        .addAll(new Label(
            path
View Full Code Here

            }
        } catch (Exception exc) {
        }
        USER_TXT.setText(def_user);

        /**
         * Carico i vari vaori del login, ed imposto gli eventi da gestire.
         */
        final PasswordField PASS_TXT = (PasswordField) getFromCacheNode("pass_txt");

        PASS_TXT.setText("");
        PASS_TXT.requestFocus();

        if (DEBUG) {
            PASS_TXT.setText("1234567890");
        }

        btn_exit = (Button) getFromCacheNode("exit_btn");
        btn_exit.setFocusTraversable(false);
        btn_exit.setOnAction((ActionEvent e) -> {
            __sysExit(__EXIT_NO_ERROR__);
        });

        login_btn = (Button) getFromCacheNode("login_btn");
        login_btn.setFocusTraversable(false);

        EventHandler<ActionEvent> eh = (ActionEvent event) -> {
            try {
                checkLogin(USER_TXT, PASS_TXT);
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        };

        login_btn.setOnAction(eh);
        USER_TXT.setOnAction(eh);
        PASS_TXT.setOnAction(eh);

        //--------------------------------------------------------------------//
        //--------------------------------------------------------------------//
        //--------------------------------------------------------------------//
        Label tips_login = (Label) getFromCacheNode("tips_login");
View Full Code Here

            }
        } catch (Exception exc) {
        }
        USER_TXT.setText(def_user);

        /**
         * Carico i vari vaori del login, ed imposto gli eventi da gestire.
         */
        final PasswordField PASS_TXT = (PasswordField) getFromCacheNode("pass_txt");

        PASS_TXT.setText("");
        PASS_TXT.requestFocus();

        if (DEBUG) {
            PASS_TXT.setText("1234567890");
        }

        btn_exit = (Button) getFromCacheNode("exit_btn");
        btn_exit.setFocusTraversable(false);
        btn_exit.setOnAction((ActionEvent e) -> {
            UtilityFX.sysExit(__EXIT_NO_ERROR__);
        });

        login_btn = (Button) getFromCacheNode("login_btn");
        login_btn.setFocusTraversable(false);

        EventHandler<ActionEvent> eh = (ActionEvent event) -> {
            try {
                checkLogin(USER_TXT, PASS_TXT);
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        };

        login_btn.setOnAction(eh);
        USER_TXT.setOnAction(eh);
        PASS_TXT.setOnAction(eh);

        //--------------------------------------------------------------------//
        //--------------------------------------------------------------------//
        //--------------------------------------------------------------------//
        Label tips_login = (Label) getFromCacheNode("tips_login");
View Full Code Here

            }
        } catch (Exception exc) {
        }
        USER_TXT.setText(def_user);

        /**
         * Carico i vari vaori del login, ed imposto gli eventi da gestire.
         */
        final PasswordField PASS_TXT = (PasswordField) getFromCacheNode("pass_txt");

        PASS_TXT.setText("");
        PASS_TXT.requestFocus();

        if (DEBUG) {
            PASS_TXT.setText("1234567890");
        }

        btn_exit = (Button) getFromCacheNode("exit_btn");
        btn_exit.setFocusTraversable(false);
        btn_exit.setOnAction((ActionEvent e) -> {
            UtilityFX.sysExit(__EXIT_NO_ERROR__);
        });

        login_btn = (Button) getFromCacheNode("login_btn");
        login_btn.setFocusTraversable(false);

        EventHandler<ActionEvent> eh = (ActionEvent event) -> {
            try {
                checkLogin(USER_TXT, PASS_TXT);
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        };

        login_btn.setOnAction(eh);
        USER_TXT.setOnAction(eh);
        PASS_TXT.setOnAction(eh);

        //--------------------------------------------------------------------//
        //--------------------------------------------------------------------//
        //--------------------------------------------------------------------//
        Label tips_login = (Label) getFromCacheNode("tips_login");
View Full Code Here

    public void setValueInPassword(char[] password) {
        clear();
        boolean prec_disa = isEditorDisable();
        hidden_field = null;
        clear_field = null;
        pass_field = new PasswordField();
        pass_field.setDisable(prec_disa);
        pass_field.setPrefWidth(pane.getPrefWidth());
        pass_field.setText(new String(password));
        pane.getChildren().add(pass_field);
        setTypeImageCombo((int) SensibleValueTypeListener.PASS_VALUE_TYPE);
View Full Code Here

    public void setValueInPassword(char[] password) {
        clear();
        boolean prec_disa = isEditorDisable();
        hidden_field = null;
        clear_field = null;
        pass_field = new PasswordField();
        pass_field.setDisable(prec_disa);
        pass_field.setPrefWidth(pane.getPrefWidth());
        pass_field.setText(new String(password));
        pane.getChildren().add(pass_field);
        setTypeImageCombo((int) SensibleValueTypeListener.PASS_VALUE_TYPE);
View Full Code Here

    public void setValueInPassword(char[] password) {
        clear();
        boolean prec_disa = isEditorDisable();
        hidden_field = null;
        clear_field = null;
        pass_field = new PasswordField();
        pass_field.setDisable(prec_disa);
        pass_field.setPrefWidth(pane.getPrefWidth());
        pass_field.setText(new String(password));
        pane.getChildren().add(pass_field);
        setTypeImageCombo((int) SensibleValueTypeListener.PASS_VALUE_TYPE);
View Full Code Here

      sl.setSnapToTicks(true);
      // POJO binding magic...
      personPA.bindBidirectional(path, sl.valueProperty());
      ctrl = sl;
    } else if (controlType == PasswordField.class) {
      final PasswordField tf = new PasswordField() {
        @Override
        public void replaceText(int start, int end, String text) {
          if (matchTest(text)) {
            super.replaceText(start, end, text);
          }
        }

        @Override
        public void replaceSelection(String text) {
          if (matchTest(text)) {
            super.replaceSelection(text);
          }
        }

        private boolean matchTest(String text) {
          return text.isEmpty()
              || (text.matches(restictTo) && (getText() == null || getText()
                  .length() < maxChars));
        }
      };
      // POJO binding magic...
      personPA.bindBidirectional(path, tf.textProperty());
      ctrl = tf;
    } else if (controlType == CalendarTextField.class) {
      final CalendarTextField ctf = new CalendarTextField();
      personPA.bindBidirectional(path, ctf.calendarProperty(),
          Calendar.class);
      ctrl = ctf;
    } else if (controlType == ListSpinner.class) {
      final ListSpinner<T> ls = new ListSpinner<>(choices)
          .withCyclic(true);
      personPA.bindBidirectional(path, ls.valueProperty(),
          (Class<T>) choices[0].getClass());
      ctrl = ls;
    } else {
      final TextField tf = controlType == PasswordField.class ? new PasswordField() {
        @Override
        public void replaceText(int start, int end, String text) {
          if (matchTest(text)) {
            super.replaceText(start, end, text);
          }
        }

        @Override
        public void replaceSelection(String text) {
          if (matchTest(text)) {
            super.replaceSelection(text);
          }
        }

        private boolean matchTest(String text) {
          return text.isEmpty()
              || (text.matches(restictTo) && (getText() == null || getText()
                  .length() < maxChars));
        }
      }
          : new TextField() {
            @Override
            public void replaceText(int start, int end, String text) {
              if (matchTest(text)) {
                super.replaceText(start, end, text);
              }
            }

            @Override
            public void replaceSelection(String text) {
              if (matchTest(text)) {
                super.replaceSelection(text);
              }
            }

            private boolean matchTest(String text) {
              return text.isEmpty()
                  || (text.matches(restictTo) && (getText() == null || getText()
                      .length() < maxChars));
            }
          };
      // POJO binding magic...
      personPA.bindBidirectional(path, tf.textProperty());
      ctrl = tf;
    }
    box.getChildren()
        .addAll(new Label(
            path
View Full Code Here

        textfieldBox3.setSpacing(10);
        textfieldBox3.setPadding(new Insets(10));
        TextField tf5 = new TextField("non-editable textfield");
        tf5.setEditable(false);
        textfieldBox3.getChildren().add(tf5);
        PasswordField pw1 = new PasswordField();
        pw1.setText("password");
        textfieldBox3.getChildren().add(pw1);
        txts.getChildren().add(textfieldBox3);
        VBox textareaBox = new VBox();
        textareaBox.setSpacing(10);
        textareaBox.setPadding(new Insets(10));
View Full Code Here

TOP

Related Classes of javafx.scene.control.PasswordField

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.