本文整理汇总了Java中javafx.scene.control.PasswordField.setMinWidth方法的典型用法代码示例。如果您正苦于以下问题:Java PasswordField.setMinWidth方法的具体用法?Java PasswordField.setMinWidth怎么用?Java PasswordField.setMinWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.PasswordField
的用法示例。
在下文中一共展示了PasswordField.setMinWidth方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: show
import javafx.scene.control.PasswordField; //导入方法依赖的package包/类
public String show(Stage stage) {
GridPane grid = new GridPane();
myStage = stage;
//myStage.getScene().getStylesheets().add(Settings.CSS_FILE_PATH);
grid.setHgap(10);
grid.setVgap(10);
grid.setPadding(new Insets(0, 10, 0, 10));
passphraseEnterField_ = new PasswordField(); passphraseEnterField_.setPromptText("Insert your encription passphrase");
//TODO add an Icon here
double minWidth = 700;
passphraseEnterField_.setMinWidth(minWidth);
String label = "";
if (isFirstTime)
label= "Passphrase";
else
label = "Current passphrase";
grid.add(new Label(label), 0, 0);
grid.add(passphraseEnterField_, 0, 1);
Callback<Void, Void> myCallback = new Callback<Void, Void>() {
@Override
public Void call(Void param) {
//maybe TODO
return null;
}
};
String message = "";
if (isFirstTime)
message= "Please insert the passphrase to decrypt your data\n";
else
message = "Please insert the old passphrase";
Dialogs.DialogResponse resp = Dialogs.showCustomDialog(myStage,
grid,
message,
"The bot needs a passphrase",
Dialogs.DialogOptions.OK_CANCEL,
myCallback);
if (resp == resp.CLOSED || resp == resp.CANCEL)
{
if(isFirstTime)
{
Dialogs.showErrorDialog(myStage,
"To run the bot you need to enter the passphrase",
"Missimg passphrase",
"Error");
Utils.log("To run the bot you need to enter the passphrase ",Utils.LOG_ERR);
System.exit(0);
}
else
{
}
}
//You must check the resp, since input fields' texts are returned regardless of what button was pressed.
//(ie. If user clicked 'Cancel' disregard the input)
return passphraseEnterField_.getText();
}