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


Java PasswordField.setMinWidth方法代碼示例

本文整理匯總了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;
 
}
 
開發者ID:adv0r,項目名稱:botcoin,代碼行數:34,代碼來源:PassphraseDialog.java

示例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();
}
 
開發者ID:adv0r,項目名稱:botcoin,代碼行數:65,代碼來源:PassphrasePrompt.java


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