当前位置: 首页>>代码示例>>Java>>正文


Java PasswordField类代码示例

本文整理汇总了Java中javafx.scene.control.PasswordField的典型用法代码示例。如果您正苦于以下问题:Java PasswordField类的具体用法?Java PasswordField怎么用?Java PasswordField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PasswordField类属于javafx.scene.control包,在下文中一共展示了PasswordField类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: start

import javafx.scene.control.PasswordField; //导入依赖的package包/类
@Override
public void start(Stage stage) {
    Group root = new Group();
    Scene scene = new Scene(root, 260, 80);
    stage.setScene(scene);
    stage.setTitle("Password Field Sample");

    VBox vb = new VBox();
    vb.setPadding(new Insets(10, 0, 0, 10));
    vb.setSpacing(10);
    HBox hb = new HBox();
    hb.setSpacing(10);
    hb.setAlignment(Pos.CENTER_LEFT);

    Label label = new Label("Password");
    final PasswordField pb = new PasswordField();  
    pb.setText("Your password");

    pb.setOnAction((ActionEvent e) -> {
        if (!pb.getText().equals("T2f$Ay!")) {
            message.setText("Your password is incorrect!");
            message.setTextFill(Color.rgb(210, 39, 30));
        } else {
            message.setText("Your password has been confirmed");
            message.setTextFill(Color.rgb(21, 117, 84));
        }
        pb.clear();
    });

    hb.getChildren().addAll(label, pb);
    vb.getChildren().addAll(hb, message);

    scene.setRoot(vb);
    stage.show();
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:36,代码来源:PasswordFiledSample.java

示例2: initData

import javafx.scene.control.PasswordField; //导入依赖的package包/类
@Override
public void initData(Parent node, Map<String, String> bundle) {
	et_download_path = (TextField) node.lookup("#et_download_path");
	et_deploy_path = (TextField) node.lookup("#et_deploy_path");
	et_secret = (TextField) node.lookup("#et_secret");
	et_git_username = (TextField) node.lookup("#et_git_username");
	et_git_passwd = (PasswordField) node.lookup("#et_git_passwd");
	et_app_password = (PasswordField) node.lookup("#et_app_password");
	et_app_password_second = (PasswordField) node.lookup("#et_app_password_second");
	btn_submit = (Button) node.lookup("#btn_submit");

	readFromProperty();

	btn_submit.setOnAction(e->{
		String message = "";
		if(!et_app_password.getText().trim().equals(et_app_password_second.getText().trim())){
			message = "�����������벻һ�£�";
			DialogHelper.alert("����", message);
			return;
		}
		if(!"".equals(et_app_password.getText().trim()) && et_app_password.getText().trim().length() < 5){
			message = "���볤��̫��,������ȫ��";
			DialogHelper.alert("����", message);
			return;
		}

		writeToProperty();
	});


}
 
开发者ID:coding-dream,项目名称:Notebook,代码行数:32,代码来源:SettingFragment.java

示例3: confirmPassword

import javafx.scene.control.PasswordField; //导入依赖的package包/类
/**
 * 确认两次密码是否一致.
 * @param password 密码输入框
 * @param rePassword 确认密码输入框
 */
private void confirmPassword(PasswordField password, PasswordField rePassword,
                             Label label, boolean[] ok) {
    rePassword.focusedProperty().addListener(
        (observable, oldValue, newValue) -> {
            if (!rePassword.getText().equals(password.getText())) {
                label.setText("两次密码不一致");
                label.setTextFill(Color.rgb(255, 0, 0));
                ok[0] = false;
                return;
            }
            label.setText("");
            ok[0] = true;
        }
    );
}
 
开发者ID:Kuangcp,项目名称:MythRedisClient,代码行数:21,代码来源:ConnectController.java

示例4: PasswordPane

import javafx.scene.control.PasswordField; //导入依赖的package包/类
public PasswordPane()
{
    super();
    super.setPrefHeight(AppTabPane.CONTENT_HEIGHT);
    super.setPrefWidth(AppTabPane.CONTENT_WIDTH);
    super.getStyleClass().add("pane");
    super.setPadding(new Insets(15,15,15,15));
    super.setVgap(10);
    
    buttons = new HBox();
    buttons.setSpacing(10);
    
    Label promptText = new Label("Sudo required.");
    
    okButton = new Button("OK");
    cancelButton = new Button("Cancel");
    
    buttons.getChildren().addAll(okButton, cancelButton);
    
    password = new PasswordField();
    
    okButton.setPrefWidth(60);
    okButton.setOnMouseClicked(new OkButtonHandler());
    
    cancelButton.setOnMouseClicked(new CancelButtonHandler());
    
    password.setPromptText("Password");
    
    super.add(promptText, 0, 0);
    super.add(password, 0, 1);
    super.add(buttons, 0, 2);

}
 
开发者ID:BlueGoliath,项目名称:Goliath-Overclocking-Utility-FX,代码行数:34,代码来源:PasswordPane.java

示例5: isPasswordField

import javafx.scene.control.PasswordField; //导入依赖的package包/类
private boolean isPasswordField() {
    return new GetAction<Boolean>() {
        @Override
        public void run(Object... os) throws Exception {
            setResult(PasswordField.class.isAssignableFrom(taTesting.getControl().getClass()));
        }
    }.dispatch(Root.ROOT.getEnvironment());
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:9,代码来源:TextInputBase.java

示例6: shouldClickOkButtonWhenProxyPasswordIsInvalid

import javafx.scene.control.PasswordField; //导入依赖的package包/类
@Test
public void shouldClickOkButtonWhenProxyPasswordIsInvalid() {
    PasswordField proxyPasswordTextField = find("#proxyPasswordTextField");
    proxyPasswordTextField.setText(StringUtils.repeat('x', 256));

    SystemSettings mockSystemSettings = mock(SystemSettings.class);
    when(mockSettingsManager.getSystemSettings()).thenReturn(mockSystemSettings);

    clickOn("#okButton");

    verify(mockSystemSettings, never()).setCacheSizeMb(anyInt());
    verify(mockSystemSettings, never()).setProxyHost(anyString());
    verify(mockSystemSettings, never()).setProxyPort(anyInt());
    verify(mockSystemSettings, never()).setProxyRequiresAuthentication(anyBoolean());
    verify(mockSystemSettings, never()).setProxyUsername(anyString());
    verify(mockSystemSettings, never()).setProxyPassword(anyString());
    verify(mockSettingsManager, never()).saveSystemSettings();
    verify(spySettingsView, never()).close();
}
 
开发者ID:mpcontracting,项目名称:rpmjukebox,代码行数:20,代码来源:SettingsControllerTest.java

示例7: initControls

import javafx.scene.control.PasswordField; //导入依赖的package包/类
@Override
public void initControls()
{
    this.topLabel = new Label("This archive requires a password. Please enter a password or provide a path to a file containing the password.");
    this.topLabel.setWrapText(true);
    this.passwordLabel = new Label("Password:");
    this.passwordFileLabel = new Label("Password File:");
    this.passwordField = new PasswordField();
    this.passwordFilePathBox = new TextField();
    this.passwordFilePathBox.setEditable(false);
    this.pickPasswordFileButton = Icons.buildIconButton("Select", Icons.ICON_ELLIPSIS);
    this.passwordFilePathBox.setFocusTraversable(false);
    this.cancelButton = Icons.buildIconButton("Cancel", Icons.ICON_CROSS);
    this.continueButton = Icons.buildIconButton("Continue", Icons.ICON_TICK);
    this.continueButton.setDisable(true);
}
 
开发者ID:AstromechZA,项目名称:bunkr,代码行数:17,代码来源:PasswordDialog.java

示例8: CombinedPasswordValidator

import javafx.scene.control.PasswordField; //导入依赖的package包/类
public CombinedPasswordValidator(PasswordField txtPassword,
		StringProperty passwordErrorProperty, PasswordField txtConfirmPassword) {
	validatePassword = new TextFieldValidator(txtPassword, passwordErrorProperty, true) {
		@Override
		public ValidationResult validate(String password) {
			final String confirmPassword = validateConfirmPassword.getTextField().getText();
			return validatePasswords(password, confirmPassword);
		}
	};
	
	validateConfirmPassword = new TextFieldValidator(txtConfirmPassword) {
		@Override
		public ValidationResult validate(String confirmPassword) {
			final String password = validatePassword.getTextField().getText();
			return validatePasswords(password, confirmPassword);
		}
	};
}
 
开发者ID:PeerWasp,项目名称:PeerWasp,代码行数:19,代码来源:CombinedPasswordValidator.java

示例9: CombinedPinValidator

import javafx.scene.control.PasswordField; //导入依赖的package包/类
public CombinedPinValidator(PasswordField txtPin,
		StringProperty pinErrorProperty, PasswordField txtConfirmPin) {
	validatePin = new TextFieldValidator(txtPin, pinErrorProperty, true) {
		@Override
		public ValidationResult validate(String pin) {
			final String confirmPin = validateConfirmPin.getTextField().getText();
			return validatePins(pin, confirmPin);
		}
	};
	
	validateConfirmPin = new TextFieldValidator(txtConfirmPin) {
		@Override
		public ValidationResult validate(String confirmPin) {
			final String pin = validatePin.getTextField().getText();
			return validatePins(pin, confirmPin);
		}
	};
}
 
开发者ID:PeerWasp,项目名称:PeerWasp,代码行数:19,代码来源:CombinedPinValidator.java

示例10: marathon_select

import javafx.scene.control.PasswordField; //导入依赖的package包/类
@Test public void marathon_select() {
    PasswordField passwordFieldNode = (PasswordField) getPrimaryStage().getScene().getRoot().lookup(".password-field");
    passwordField.marathon_select("Hello World");
    new Wait("Waiting for the password field value to be set") {
        @Override public boolean until() {
            return "Hello World".equals(passwordFieldNode.getText());
        }
    };
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:10,代码来源:JavaFXPasswordFieldElementTest.java

示例11: getText

import javafx.scene.control.PasswordField; //导入依赖的package包/类
@Test public void getText() {
    PasswordField passwordFieldNode = (PasswordField) getPrimaryStage().getScene().getRoot().lookup(".password-field");
    AssertJUnit.assertEquals("", passwordField.getText());
    passwordField.marathon_select("Hello World");
    new Wait("Waiting for the password field value to be set") {
        @Override public boolean until() {
            return "Hello World".equals(passwordFieldNode.getText());
        }
    };
    AssertJUnit.assertEquals("Hello World", passwordField.getText());
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:12,代码来源:JavaFXPasswordFieldElementTest.java

示例12: PasswordFieldSample

import javafx.scene.control.PasswordField; //导入依赖的package包/类
public PasswordFieldSample() {
    PasswordField passwordFiled = new PasswordField();
    passwordFiled.setMaxSize(250, 250);
    VBox root = new VBox();
    root.getChildren().addAll(passwordFiled, new Button("Click Me!!"));
    getChildren().add(root);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:8,代码来源:PasswordFieldSample.java

示例13: display

import javafx.scene.control.PasswordField; //导入依赖的package包/类
public static void display() {
	window = new Stage();
	window.initModality(Modality.APPLICATION_MODAL);
	window.setTitle("Log In");
	HEADING = "New Login";

	Label headingLabel = new Label(HEADING);
	headingLabel.setFont(Font.font("Verdana", FontWeight.BOLD, 30));

	TextField nameTextField = new TextField();
	nameTextField.setPromptText("Name");

	TextField userNameTextField = new TextField();
	userNameTextField.setPromptText("Username");

	PasswordField passwordField = new PasswordField();
	passwordField.setPromptText("Password");
	Button generateButton = new Button("Generate");

	HBox generatePasswordArea = new HBox();
	generatePasswordArea.getChildren().addAll(passwordField, generateButton);

	Button submitButton = new Button("Submit");

	VBox layout = new VBox(10);
	layout.setPadding(new Insets(0, 20, 0, 20));
	layout.setAlignment(Pos.CENTER_LEFT);
	layout.getChildren().addAll(headingLabel, nameTextField, userNameTextField, generatePasswordArea, submitButton);

	Scene scene = new Scene(layout, 300, 400);
	window.setScene(scene);
	window.showAndWait();
}
 
开发者ID:MorrisB--,项目名称:MasterHash,代码行数:34,代码来源:NewLogin.java

示例14: PasswordDialog

import javafx.scene.control.PasswordField; //导入依赖的package包/类
public PasswordDialog(String whatFor) {
  setTitle(whatFor+" Password");
  setHeaderText("Please enter your "+whatFor+" password: ");

  ButtonType passwordButtonType = new ButtonType("Login", ButtonData.OK_DONE);
  getDialogPane().getButtonTypes().addAll(passwordButtonType, ButtonType.CANCEL);

  passwordField = new PasswordField();
  passwordField.setPromptText(whatFor+" password");

  HBox hBox = new HBox();
  hBox.getChildren().add(passwordField);
  hBox.setPadding(new Insets(20));

  HBox.setHgrow(passwordField, Priority.ALWAYS);

  getDialogPane().setContent(hBox);

  Platform.runLater(() -> passwordField.requestFocus());

  setResultConverter(dialogButton -> {
    if (dialogButton == passwordButtonType) {
      return passwordField.getText();
    }
    return "";
  });
}
 
开发者ID:billwi,项目名称:CyberTigerScoreboard,代码行数:28,代码来源:PasswordDialog.java

示例15: LoginComponent

import javafx.scene.control.PasswordField; //导入依赖的package包/类
public LoginComponent(BorderPane p) {
	GridPane g = new GridPane();

	{
		g.add(new Label("Username"), 0, 0);
		username = new TextField();
		g.add(username, 1, 0);
	}

	{
		g.add(new Label("Password"), 0, 1);
		password = new PasswordField();
		g.add(password, 1, 1);
	}

	Button button = new Button("Login");
	button.setOnAction(e -> {
		if( username.getText().equals("[email protected]") ) {
			if( password.getText().equals("test") ) {
				status = Status.ok();
			} else {
				status = Status.status(Status.State.ERROR, 2, "Invalid password for '"+username.getText()+"'", null);
			}
		} else {
			status = Status.status(Status.State.ERROR, 1, "Unknown username", null);
		}
	});
	g.add(button, 1, 2);
	g.setMaxSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE);
	g.setMinSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE);
	p.setCenter(g);
}
 
开发者ID:BestSolution-at,项目名称:FX-Test,代码行数:33,代码来源:BaseTestFXComponentTest.java


注:本文中的javafx.scene.control.PasswordField类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。