public char[] getPassword() { return passwordField.getPassword(); }
public char[] getPassword() { return passwordField.getPassword(); }
JPasswordField pf = new JPasswordField(); int okCxl = JOptionPane.showConfirmDialog(null, pf, "Enter Password", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); if (okCxl == JOptionPane.OK_OPTION) { String password = new String(pf.getPassword()); System.err.println("You entered: " + password); }
JPanel panel = new JPanel(); JLabel label = new JLabel("Enter a password:"); JPasswordField pass = new JPasswordField(10); panel.add(label); panel.add(pass); String[] options = new String[]{"OK", "Cancel"}; int option = JOptionPane.showOptionDialog(null, panel, "The title", JOptionPane.NO_OPTION, JOptionPane.PLAIN_MESSAGE, null, options, options[1]); if(option == 0) // pressing OK button { char[] password = pass.getPassword(); System.out.println("Your password is: " + new String(password)); }
private void populateBasicDigestAuth(BasicDigestAuthBaseBean bean) { if(StringUtil.isNotEmpty(jtf_host.getText())) bean.setHost(jtf_host.getText()); if(StringUtil.isNotEmpty(jtf_realm.getText())) bean.setRealm(jtf_realm.getText()); if(StringUtil.isNotEmpty(jtf_username.getText())) bean.setUsername(jtf_username.getText()); if(jpf_password.getPassword().length > 0) bean.setPassword(jpf_password.getPassword()); bean.setPreemptive(jcb_preemptive.isSelected()); }
char[] password = jpf_password.getPassword();
errors.add("Username is empty."); if(StringUtil.isEmpty(new String(jpf_ntlm_password.getPassword()))){ errors.add("Password is empty.");
public SSLKeyStore getKeyStore() { final String filePath = jtf_file.getText(); if(StringUtil.isNotEmpty(filePath)) { SSLKeyStoreBean out = new SSLKeyStoreBean(); out.setType(jp_type.getSelectedKeyStoreType()); out.setFile(new File(filePath)); out.setPassword(jpf_pwd.getPassword()); return out; } return null; }
return passwordField.getPassword();
char[] password = jpf_password.getPassword();
@Override public Auth getAuth() { final String method = (String) jcb_types.getSelectedItem(); if(AuthHelper.isBasic(method)) { BasicAuthBean out = new BasicAuthBean(); populateBasicDigestAuth(out); return out; } else if(AuthHelper.isDigest(method)) { DigestAuthBean out = new DigestAuthBean(); populateBasicDigestAuth(out); return out; } else if(AuthHelper.isNtlm(method)) { NtlmAuthBean out = new NtlmAuthBean(); out.setDomain(jtf_domain.getText()); out.setWorkstation(jtf_workstation.getText()); out.setUsername(jtf_ntlm_username.getText()); out.setPassword(jpf_ntlm_password.getPassword()); return out; } else if(AuthHelper.isBearer(method)) { OAuth2BearerAuthBean out = new OAuth2BearerAuthBean(); out.setOAuth2BearerToken(jtf_bearer_token.getText()); return out; } return null; }
private String getPassword() { char[] password = passwordField.getPassword(); if (password != null && password.length != 0) { return String.valueOf(password); } return null; }
private void saveSettings() { ConsoleFrame.getPreferences().put("serverAddress", txtServer.getText()); ConsoleFrame.getPreferences().put("serverPort", txtPort.getText()); ConsoleFrame.getPreferences().put("autoConnect", Boolean.toString(chkAutoConnect.isSelected())); ConsoleFrame.getPreferences().put("proxyAddress", txtProxyServer.getText()); ConsoleFrame.getPreferences().put("proxyPort", txtProxyPort.getText()); ConsoleFrame.getPreferences().put("proxyType", cbProxyType.getSelectedItem().toString()); ConsoleFrame.getPreferences().put("proxyUsername", txtProxyUserName.getText()); char[] input = txtPasswordField.getPassword(); ConsoleFrame.getPreferences().put("proxyPassword", new String(input)); Arrays.fill(input, '0'); }
if (option == 0) password = new String(pass.getPassword()); continue;
private void btnConnectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnConnectActionPerformed if (txtPassword.getPassword().length == 0) { JOptionPane.showMessageDialog(rootPane, "Please provide a password"); return; connection.setHost(this.txtServer.getText()); connection.setPort(Integer.valueOf(this.txtPort.getText())); connection.setAdminPassword(new String(txtPassword.getPassword())); connection.setUsername("Admin"); connection.setProxyType((ProxyType) this.cbProxyType.getSelectedItem()); connection.setProxyPort(Integer.valueOf(this.txtProxyPort.getText())); connection.setProxyUsername(this.txtProxyUserName.getText()); connection.setProxyPassword(new String(this.txtPasswordField.getPassword()));
String.valueOf(passwordField.getPassword()) });
/** * Returns the password to use for the new account. * * @return the password to use for the new account. */ public String getPassword() { return new String(passwordField.getPassword()); }
/** * Get the password from the dialog. * * @return The password. */ public String getPassword() { return new String(password.getPassword()); }
public boolean isPasswordProtected() { String password = new String(passwordField.getPassword()); if (password.length() > 0) { return true; } return false; }
save(prefs, dialog.rememberPswd, KEY_PROXY_REMEMBER, "true", "false", UPDATE_CACHE_POLICY); if (dialog.rememberPswd.isSelected()) { char[] input = txtPasswordField.getPassword(); prefs.put(KEY_PROXY_PSWD, new String(input));