private void readFromFile() { String filename = checkFileSuffix(); File file = new File(fileLocation.getText().trim(), filename); try { CredentialsReader reader = new CredentialsReader(file); Credentials credentials = reader.read(); userName.setText(credentials.getUsername()); password1.setText(credentials.getPassword()); password2.setText(credentials.getPassword()); messageText.setText(credentials.getUserData()); } catch (Exception e) { messageText.setText("Error occurred: " + e.getLocalizedMessage()); this.filename.requestFocus(); return; } userName.requestFocus(); }
/** * {@inheritDoc} */ @Override public void initializeParts() { super.initializeParts(); getStyleClass().add("simple-password-control"); stack = new StackPane(); editableField = new javafx.scene.control.PasswordField(); editableField.setText(field.getValue()); readOnlyLabel = new Label(obfuscate(field.getValue())); fieldLabel = new Label(field.labelProperty().getValue()); editableField.setPromptText(field.placeholderProperty().getValue()); }
@Override public void testImpl(Stage stage) { if (logger.isDebugEnabled()) { logger.debug("testrunn at -> " + sdf.format(new Date())); } stage.setTitle("Login"); //i18n stage.setScene(new Scene(root, 300, 275)); stage.show(); final Scene scene = stage.getScene(); //TestCode final TextField login = (TextField) scene.lookup("#loginField"); login.setText("LOGIN"); final PasswordField passwd = (PasswordField) scene.lookup("#passwordField"); passwd.setText("LOGIN"); final LoginPaneController controller = root.getController(); controller.handleSubmitButtonAction(new ActionEvent()); final Text feedback = (Text) scene.lookup("#feedback"); Assert.assertEquals("LOGIN logged in successfully", feedback.getText()); } }
@Override public void testImpl(Stage stage) { stage.setTitle("Login"); stage.setScene(new Scene(root, 300, 275)); //stage.show(); final Scene scene = stage.getScene(); //TestCode final TextField login = (TextField) scene.lookup("#loginField"); login.setText("Hoppel"); final PasswordField passwd = (PasswordField) scene.lookup("#passwordField"); passwd.setText("LOGIN"); final LoginPaneController controller = root.getController(); controller.handleSubmitButtonAction(new ActionEvent()); final Text feedback = (Text) scene.lookup("#feedback"); Assert.assertNotEquals("LOGIN logged in successfully", feedback.getText()); } }
textfieldBox3.getChildren().add(tf5); PasswordField pw1 = new PasswordField(); pw1.setText("password"); textfieldBox3.getChildren().add(pw1); txts.getChildren().add(textfieldBox3);