當前位置: 首頁>>代碼示例>>Java>>正文


Java PasswordField.setPromptText方法代碼示例

本文整理匯總了Java中javafx.scene.control.PasswordField.setPromptText方法的典型用法代碼示例。如果您正苦於以下問題:Java PasswordField.setPromptText方法的具體用法?Java PasswordField.setPromptText怎麽用?Java PasswordField.setPromptText使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.scene.control.PasswordField的用法示例。


在下文中一共展示了PasswordField.setPromptText方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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

示例2: 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

示例3: 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

示例4: loginInput

import javafx.scene.control.PasswordField; //導入方法依賴的package包/類
private HBox loginInput () {
    HBox input = new HBox(TEXT_SPACING);

    myLoginUsername = new TextField();
    myLoginUsername.setPromptText(USR);
    myLoginPassword = new PasswordField();
    myLoginPassword.setPromptText(PS);

    input.getChildren().addAll(myLoginUsername, myLoginPassword);
    input.setAlignment(Pos.CENTER);
    input.setPrefHeight(HEIGHT / 2);

    return input;
}
 
開發者ID:sjain28,項目名稱:Game-Engine-Vooga,代碼行數:15,代碼來源:LoginScreen.java

示例5: userInput

import javafx.scene.control.PasswordField; //導入方法依賴的package包/類
private HBox userInput () {
    HBox input = new HBox(TEXT_SPACING);

    myMakeUsername = new TextField();
    myMakeUsername.setPromptText(USR);
    myMakeDisplayname = new TextField();
    myMakeDisplayname.setPromptText("Display Name");
    myMakePassword = new PasswordField();
    myMakePassword.setPromptText(PS);

    input.getChildren().addAll(myMakeUsername, myMakeDisplayname, myMakePassword);
    input.setAlignment(Pos.CENTER);
    input.setPrefHeight(HEIGHT / 2);

    return input;
}
 
開發者ID:sjain28,項目名稱:Game-Engine-Vooga,代碼行數:17,代碼來源:LoginScreen.java

示例6: constructContainer

import javafx.scene.control.PasswordField; //導入方法依賴的package包/類
@Override
public Parent constructContainer()
{
	bp.setId("registerviewbg");
	
	AllFields = new VBox(50);
	AllFields.setAlignment(Pos.CENTER);
	AllFields.setMaxWidth(300);
	AllFields.setPadding(new Insets(20));
	
	Controls = new HBox(50);
	Controls.setAlignment(Pos.CENTER);
	Controls.setPadding(new Insets(20));
	
	txtName = new TextField();
	txtName.setPromptText("Username");
	pwPassword = new PasswordField();
	pwPassword.setPromptText("Passwort");
	pwToCheck = new PasswordField();
	pwToCheck.setPromptText("Passwort wiederholen");
	txtMail = new TextField();
	txtMail.setPromptText("E-Mail");
	
	reg = new AppButton("Registrieren");
	home = new HomeButton(getFXController());
	
	AllFields.getChildren().addAll(txtName, pwPassword, pwToCheck, txtMail, reg);
	Controls.getChildren().addAll(home);
	
	bp.setBottom(Controls);
	bp.setCenter(AllFields);
	
	return bp;
}
 
開發者ID:RookStudios,項目名稱:Lernkartei,代碼行數:35,代碼來源:RegisterView.java

示例7: addGridPane

import javafx.scene.control.PasswordField; //導入方法依賴的package包/類
private Node addGridPane() {
  //see http://docs.oracle.com/javafx/2/ui_controls/editor.htm
    
   GridPane grid = new GridPane();
   grid.setHgap(10);
   grid.setVgap(10);
   
   infoLabel = new Label("Insert a passphrase to encrypt your data and protect the application. \n"
           + " Use your fantasy but don't forget it, \n"
           + " you will need it to open the application.\n "
           + " Passphrase must contain at least "+Settings.MIN_PASS_LENGTH+" characters."); 
   
   passphraseField = new PasswordField(); passphraseField.setPromptText("Insert your encription passphrase");
   passphrase2Field = new PasswordField(); passphrase2Field.setPromptText("Confirm your encription passphrase");
   
   passphraseField.setId("pwdField");
   passphrase2Field.setId("pwdField");

   passphraseField.setMinWidth(400);            
   passphrase2Field.setMinWidth(400);

   TypingHandler typeHandler = new TypingHandler();
   passphrase2Field.addEventHandler(KeyEvent.KEY_RELEASED, typeHandler);
   passphraseField.addEventHandler(KeyEvent.KEY_RELEASED, typeHandler);


   grid.add(infoLabel, 0, 0);
   grid.add(passphraseField, 0, 1);      
   grid.add(passphrase2Field, 0, 2);    
   
   return grid;
 
}
 
開發者ID:adv0r,項目名稱:botcoin,代碼行數:34,代碼來源:PassphraseDialog.java

示例8: PasswordDialog

import javafx.scene.control.PasswordField; //導入方法依賴的package包/類
public PasswordDialog() {
    setTitle("HandiNAVI Login");
    setHeaderText("Enter your password.");

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

    passwordField = new PasswordField();
    passwordField.setPromptText("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 null;
    });
}
 
開發者ID:ChiralBehaviors,項目名稱:Ultrastructure,代碼行數:31,代碼來源:PasswordDialog.java

示例9: constructContainer

import javafx.scene.control.PasswordField; //導入方法依賴的package包/類
@Override
public Parent constructContainer()
{
	bp.setId("loginviewbg");

	Errorbox = new HBox(50);
	Errorbox.setAlignment(Pos.CENTER);
	Errorbox.setPadding(new Insets(20));

	AllFields = new VBox(50);
	AllFields.setAlignment(Pos.CENTER);
	AllFields.setMaxWidth(300);
	AllFields.setPadding(new Insets(20));

	Controls = new HBox(50);
	Controls.setAlignment(Pos.CENTER);
	Controls.setPadding(new Insets(20));

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

	pwPassword = new PasswordField();
	pwPassword.setPromptText("Passwort");
	;

	home = new HomeButton(getFXController());
	reg = new AppButton("Noch kein Profil?");
	log = new AppButton("Login");

	errorText = new Label("");
	Errorbox.getChildren().addAll(errorText);

	Controls.getChildren().addAll(home, reg);

	AllFields.getChildren().addAll(txtName, pwPassword, log);

	bp.setTop(Errorbox);
	bp.setCenter(AllFields);
	bp.setBottom(Controls);

	reg.setOnAction(e -> getFXController().showView("registerview"));
	log.setOnAction(e ->
	{

		// So that you can always check again who was logged in last,
		// but if user logged in, it should be set as ""
		Globals.lastRegisteredUser = "";

		String name = txtName.getText();
		String password = pwPassword.getText();

		// So that entries don't exist after leaving the view
		txtName.clear();
		pwPassword.clear();

		if (name.equals("[email protected]") && BCrypt.checkpw(password, "$2a$12$8hcwdnkJ7uO3FvDEG/1fv.vaSNI/FfZqEzfUZFUYRUHLzRjkV/Z5.")/*plaintext-password: "gibb"*/)
		{
			Globals.username = name;
			getFXController().showView("managementselectionview");
		} else
		{
			Alert alert = new Alert(AlertType.ERROR);
			alert.setTitle("Fehler 0x0001");
			alert.setHeaderText("Login-Daten inkorrekt.");
			alert.setContentText(
					"Benutzername und Passwort stimmen nicht �berein oder existieren nicht.\nStellen Sie sicher, dass Ihre Eingaben korrekt sind.");
			pwPassword.clear();
			txtName.clear();
			alert.showAndWait();
		}
	});

	return bp;
}
 
開發者ID:CoffeeCodeSwitzerland,項目名稱:Lernkartei_2017,代碼行數:75,代碼來源:LoginView.java

示例10: openLoginDialog

import javafx.scene.control.PasswordField; //導入方法依賴的package包/類
private void openLoginDialog(WindowEvent evt) {
    // Create the custom dialog.
        Dialog<Pair<String, String>> dialog = new Dialog<>();
        dialog.setTitle("Closing app...");
        dialog.setHeaderText("Root Credentials Needed");
        
        ButtonType loginButtonType = new ButtonType("Exit", ButtonData.OK_DONE);
        dialog.getDialogPane().getButtonTypes().addAll(loginButtonType, ButtonType.CANCEL);

        GridPane grid = new GridPane();
        grid.setHgap(10);
        grid.setVgap(10);
        grid.setPadding(new Insets(20, 150, 10, 10));

        TextField username = new TextField();
        username.setPromptText("Username");
        PasswordField password = new PasswordField();
        password.setPromptText("Password");

        grid.add(new Label("Username:"), 0, 0);
        grid.add(username, 1, 0);
        grid.add(new Label("Password:"), 0, 1);
        grid.add(password, 1, 1);
        dialog.getDialogPane().getStylesheets().add("/styles/Styles.css");
        Node loginButton = dialog.getDialogPane().lookupButton(loginButtonType);
        loginButton.setDisable(true);

        username.textProperty().addListener((observable, oldValue, newValue) -> {
            loginButton.setDisable(newValue.trim().isEmpty());
        });

        dialog.getDialogPane().setContent(grid);

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

        dialog.setResultConverter(dialogButton -> {
            if (dialogButton == loginButtonType) {
                return new Pair<>(username.getText(), password.getText());
            }else{
                return new Pair<>("","");
            }
        });

        Optional<Pair<String, String>> result = dialog.showAndWait();

        result.ifPresent(usernamePassword -> {
            if(Hasher.sha(usernamePassword.getValue()).equals(">:��ܰb-���ᦦ�sض5�Z��kxK") && usernamePassword.getKey().equals("root")){
                System.exit(0);
            }else{
                evt.consume();
            }
        });
}
 
開發者ID:Obsidiam,項目名稱:amelia,代碼行數:54,代碼來源:MainApp.java

示例11: createPasswordField

import javafx.scene.control.PasswordField; //導入方法依賴的package包/類
public static PasswordField createPasswordField(String promptText)
{
	PasswordField field = new PasswordField();
	field.setPromptText(promptText);
	return field;
}
 
開發者ID:PolyphasicDevTeam,項目名稱:NoMoreOversleeps,代碼行數:7,代碼來源:JavaFxHelper.java

示例12: showChangedPassword

import javafx.scene.control.PasswordField; //導入方法依賴的package包/類
public void showChangedPassword()
{
	changepass= new Stage();
	changepass.setTitle("Change Password");
	changepass.initModality(Modality.APPLICATION_MODAL);
	changepass.getIcons().add(new Image("/pic/slogo.png"));
	lname= new Label("Username");
	txtusername= new TextField();
	txtusername.setText(MainWindow.lname.getText());
	txtusername.setEditable(false);
	txtusername.setMaxSize(250, 100);
	
	lnew= new Label("New Password");
	newpass= new PasswordField();
	newpass.setPromptText("new password");
	newpass.setMaxSize(250, 100);
	
	btnsave= new Button("Save");
	btnsave.setOnAction(e ->{
		setChangePass();
	});
	btnclose= new Button("Close");
	btnclose.setOnAction(e ->{
		changepass.close();
	});
	
	VBox lay1= new VBox(23);
	lay1.getChildren().addAll(lname, lnew);
	VBox lay2= new VBox(10);
	lay2.getChildren().addAll(txtusername, newpass);
	
	HBox laydet= new HBox(10);
	laydet.setAlignment(Pos.CENTER);
	laydet.setPadding(new Insets(10,10,10,10));
	laydet.setBorder(new Border(new BorderStroke(Color.LIGHTGREY, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, BorderWidths.DEFAULT)));
	laydet.getChildren().addAll(lay1, lay2);
	
	HBox laybtn= new HBox(10);
	laybtn.setAlignment(Pos.CENTER_RIGHT);
	laybtn.getChildren().addAll(btnsave, btnclose);
	
	VBox layall= new VBox(10);
	layall.setPadding(new Insets(10,10,10,10));
	layall.getChildren().addAll(laydet, laybtn);
	layall.setStyle("-fx-background-color: linear-gradient(#E4E9A9, #9CD777);");
	scene1= new Scene(layall);
	scene1.getStylesheets().add(ChangePassword.class.getResource("users.css").toExternalForm());
	changepass.setScene(scene1);
	changepass.setResizable(false);
	changepass.show();
}
 
開發者ID:mikemacharia39,項目名稱:gatepass,代碼行數:52,代碼來源:ChangePassword.java

示例13: showLoginDialog

import javafx.scene.control.PasswordField; //導入方法依賴的package包/類
/**
 * login Dialog 로그인 처리 다이얼로그
 *
 * @param consumer
 * @return
 */
public static <T> Optional<Pair<String, String>> showLoginDialog(Consumer<? super Pair<String, String>> consumer) {

	// Create the custom dialog.
	Dialog<Pair<String, String>> dialog = new Dialog<>();
	dialog.setTitle("Login Dialog");
	dialog.setHeaderText("Look, a Custom Login Dialog");
	dialog.setGraphic(new ImageView(new Image("file:resources/images/login.png")));

	// Set the button types.
	ButtonType loginButtonType = new ButtonType("Login", ButtonData.OK_DONE);
	ButtonType localButtonType = new ButtonType("Local", ButtonData.APPLY);

	dialog.getDialogPane().getButtonTypes().addAll(loginButtonType, localButtonType, ButtonType.CANCEL);

	// Create the username and password labels and fields.
	GridPane grid = new GridPane();
	grid.setHgap(10);
	grid.setVgap(10);
	grid.setPadding(new Insets(20, 150, 10, 10));

	TextField username = new TextField();
	username.setPromptText("Username");
	PasswordField password = new PasswordField();
	password.setPromptText("Password");

	grid.add(new Label("Username:"), 0, 0);
	grid.add(username, 1, 0);
	grid.add(new Label("Password:"), 0, 1);
	grid.add(password, 1, 1);

	// Enable/Disable login button depending on whether a username was
	// entered.
	Node loginButton = dialog.getDialogPane().lookupButton(loginButtonType);
	loginButton.setDisable(true);

	// Do some validation (using the Java 8 lambda syntax).
	username.textProperty().addListener((observable, oldValue, newValue) -> {
		loginButton.setDisable(newValue.trim().isEmpty());
	});

	dialog.getDialogPane().setContent(grid);

	// Request focus on the username field by default.
	Platform.runLater(() -> username.requestFocus());

	// Convert the result to a username-password-pair when the login button
	// is clicked.
	dialog.setResultConverter(dialogButton -> {
		if (dialogButton == loginButtonType) {
			return new Pair<>(username.getText(), password.getText());
		} else if (dialogButton == localButtonType) {
			return new Pair<>(MEMO_LOCAL_USER, "");
		}
		return null;
	});

	Optional<Pair<String, String>> result = dialog.showAndWait();

	result.ifPresent(consumer);

	return result;
}
 
開發者ID:callakrsos,項目名稱:Gargoyle,代碼行數:69,代碼來源:DialogUtil.java

示例14: constructContainer

import javafx.scene.control.PasswordField; //導入方法依賴的package包/類
@Override
public Parent constructContainer()
{
	bp.setId("loginviewbg");
	
	Errorbox = new HBox(50);
	Errorbox.setAlignment(Pos.CENTER);
	Errorbox.setPadding(new Insets(20));
	
	AllFields = new VBox(50);
	AllFields.setAlignment(Pos.CENTER);
	AllFields.setMaxWidth(300);
	AllFields.setPadding(new Insets(20));
	
	Controls = new HBox(50);
	Controls.setAlignment(Pos.CENTER);
	Controls.setPadding(new Insets(20));
	
	txtName = new TextField();
	txtName.setPromptText("Username");
	
	pwPassword = new PasswordField();
	pwPassword.setPromptText("Passwort");;
	
	home = new HomeButton(getFXController());
	reg = new AppButton("Noch kein Profil?");
	log = new AppButton("Login");
	
	errorText = new Label("");
	Errorbox.getChildren().addAll(errorText);
	
	Controls.getChildren().addAll(home, reg);
	
	AllFields.getChildren().addAll(txtName, pwPassword, log);
	
	bp.setTop(Errorbox);
	bp.setCenter(AllFields);
	bp.setBottom(Controls);
	
	reg.setOnAction(e -> getFXController().showView("registerview"));		
	
	return bp;
}
 
開發者ID:RookStudios,項目名稱:Lernkartei,代碼行數:44,代碼來源:LoginView.java

示例15: collectIpCamInfo

import javafx.scene.control.PasswordField; //導入方法依賴的package包/類
private void collectIpCamInfo() {
	final Stage ipcamStage = new Stage();
	final GridPane ipcamPane = new GridPane();

	final ColumnConstraints cc = new ColumnConstraints(400);
	cc.setHalignment(HPos.CENTER);
	ipcamPane.getColumnConstraints().addAll(new ColumnConstraints(), cc);

	final TextField nameTextField = new TextField();
	ipcamPane.add(new Label("IPCam Name:"), 0, 0);
	ipcamPane.add(nameTextField, 1, 0);

	final TextField userTextField = new TextField();
	userTextField.setPromptText("Optional Username");
	ipcamPane.add(new Label("Username:"), 0, 1);
	ipcamPane.add(userTextField, 1, 1);

	final PasswordField passwordField = new PasswordField();
	passwordField.setPromptText("Optional Password");
	ipcamPane.add(new Label("Password:"), 0, 2);
	ipcamPane.add(passwordField, 1, 2);

	final TextField urlTextField = new TextField("http://");
	ipcamPane.add(new Label("IPCam URL:"), 0, 3);
	ipcamPane.add(urlTextField, 1, 3);

	final Button okButton = new Button("OK");
	okButton.setDefaultButton(true);
	ipcamPane.add(okButton, 1, 4);

	okButton.setOnAction((e) -> {
		if (nameTextField.getText().isEmpty() || urlTextField.getText().isEmpty()) {
			final Alert ipcamInfoAlert = new Alert(AlertType.ERROR);
			ipcamInfoAlert.setTitle("Missing Information");
			ipcamInfoAlert.setHeaderText("Missing Required IPCam Information!");
			ipcamInfoAlert.setResizable(true);
			ipcamInfoAlert.setContentText("Please fill in both the IPCam name and the URL.");
			ipcamInfoAlert.showAndWait();
			return;
		}

		Optional<String> username = Optional.empty();
		Optional<String> password = Optional.empty();

		if (!userTextField.getText().isEmpty() || !passwordField.getText().isEmpty()) {
			username = Optional.of(userTextField.getText());
			password = Optional.of(passwordField.getText());
		}

		final Optional<Camera> cam = config.registerIpCam(nameTextField.getText(), urlTextField.getText(), username,
				password);

		if (cam.isPresent()) {
			CheckableImageListCell.cacheCamera(cam.get(), PreferencesController.this);

			if (!configuredCameras.contains(cam.get())) {
				Platform.runLater(() -> {
					webcamListView.setItems(null);
					cameras.add(cam.get().getName());
					webcamListView.setItems(cameras);
				});
			}
		}

		ipcamStage.close();
	});

	final Scene scene = new Scene(ipcamPane);
	ipcamStage.initOwner(preferencesPane.getScene().getWindow());
	ipcamStage.initModality(Modality.WINDOW_MODAL);
	ipcamStage.setTitle("Register IPCam");
	ipcamStage.setScene(scene);
	ipcamStage.showAndWait();
}
 
開發者ID:phrack,項目名稱:ShootOFF,代碼行數:75,代碼來源:PreferencesController.java


注:本文中的javafx.scene.control.PasswordField.setPromptText方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。