Tabnine Logo
JPasswordField.getText
Code IndexAdd Tabnine to your IDE (free)

How to use
getText
method
in
javax.swing.JPasswordField

Best Java code snippets using javax.swing.JPasswordField.getText (Showing top 20 results out of 315)

origin: stackoverflow.com

 JTextField firstName = new JTextField();
JTextField lastName = new JTextField();
JPasswordField password = new JPasswordField();
final JComponent[] inputs = new JComponent[] {
    new JLabel("First"),
    firstName,
    new JLabel("Last"),
    lastName,
    new JLabel("Password"),
    password
};
int result = JOptionPane.showConfirmDialog(null, inputs, "My custom dialog", JOptionPane.PLAIN_MESSAGE);
if (result == JOptionPane.OK_OPTION) {
  System.out.println("You entered " +
      firstName.getText() + ", " +
      lastName.getText() + ", " +
      password.getText());
} else {
  System.out.println("User canceled / closed the dialog, result = " + result);
}
origin: magefree/mage

private void saveSettings() {
  String serverAddress = txtServer.getText().trim();
  MagePreferences.setServerAddress(serverAddress);
  MagePreferences.setServerPort(Integer.parseInt(txtPort.getText().trim()));
  MagePreferences.setUserName(serverAddress, txtUserName.getText().trim());
  MagePreferences.setPassword(serverAddress, txtPassword.getText().trim());
  MageFrame.getPreferences().put(KEY_CONNECT_AUTO_CONNECT, Boolean.toString(chkAutoConnect.isSelected()));
}
origin: magefree/mage

private void btnRegisterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRegisterActionPerformed
  if (!this.txtPassword.getText().equals(this.txtPasswordConfirmation.getText())) {
    MageFrame.getInstance().showError("Passwords don't match.");
    return;
  }
  connection = new Connection();
  connection.setHost(this.txtServer.getText().trim());
  connection.setPort(Integer.valueOf(this.txtPort.getText().trim()));
  connection.setUsername(this.txtUserName.getText().trim());
  connection.setPassword(this.txtPassword.getText().trim());
  connection.setEmail(this.txtEmail.getText().trim());
  PreferencesDialog.setProxyInformation(connection);
  task = new ConnectTask();
  task.execute();
}//GEN-LAST:event_btnRegisterActionPerformed
origin: magefree/mage

private void btnSubmitNewPasswordActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSubmitNewPasswordActionPerformed
  if (this.txtEmail.getText().isEmpty()) {
    MageFrame.getInstance().showError("Please enter an email address.");
    return;
  }
  if (this.txtAuthToken.getText().isEmpty()) {
    MageFrame.getInstance().showError("Please enter an auth token.");
    return;
  }
  if (this.txtPassword.getText().isEmpty()) {
    MageFrame.getInstance().showError("Please enter a new password.");
    return;
  }
  if (!this.txtPassword.getText().equals(this.txtPasswordConfirmation.getText())) {
    MageFrame.getInstance().showError("Passwords don't match.");
    return;
  }
  connection = new Connection();
  connection.setHost(this.txtServer.getText().trim());
  connection.setPort(Integer.valueOf(this.txtPort.getText().trim()));
  PreferencesDialog.setProxyInformation(connection);
  connection.setEmail(this.txtEmail.getText().trim());
  connection.setAuthToken(this.txtAuthToken.getText().trim());
  connection.setPassword(this.txtPassword.getText().trim());
  resetPasswordTask = new ResetPasswordTask();
  resetPasswordTask.execute();
}//GEN-LAST:event_btnSubmitNewPasswordActionPerformed
origin: magefree/mage

connection.setPort(Integer.valueOf(this.txtPort.getText().trim()));
connection.setUsername(this.txtUserName.getText().trim());
connection.setPassword(this.txtPassword.getText().trim());
origin: org.netbeans.modules/org-netbeans-modules-j2ee-sun-appsrv

String getTPassword() {
  return passwordField.getText();
}
origin: stackoverflow.com

 JPasswordField passwordField = (JPasswordField)event.getSource();
String text = passwordField.getText();
origin: stackoverflow.com

public static String getName() {
 JPasswordField jpf = new JPasswordField(24);
 JLabel jl = new JLabel("Enter Your Name: ");
 Box box = Box.createHorizontalBox();
 box.add(jl);
 box.add(jpf);
 int x = JOptionPane.showConfirmDialog(null, box, "Name Entry", JOptionPane.OK_CANCEL_OPTION);
 if (x == JOptionPane.OK_OPTION) {
  return jpf.getText();
 }
 return null;
}
origin: stackoverflow.com

 JPasswordField jt=new JPasswordField("I am a password");
System.out.println("The text is "+jt.getText());
System.out.println("The password is "+jt.getPassword());
origin: net.java.openjdk.cacio/cacio-shared

@Override
public String getText() {
  
  return getSwingComponent().getText();
}
origin: BTCPrivate/bitcoin-private-full-node-wallet

public String getText()
{
  return Util.removeUTF8BOM(super.getText());
}
origin: stackoverflow.com

 JTextField text1;//username
  JPasswordField p1;//password
  try{    

    Class.forName("oracle.jdbc.OracleDriver");
    Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1522:xe", "hr", "hr");

    PreparedStatement st=con.prepareStatement("SELECT * from User1 WHERE Username = ? AND Password = ? ");

    st.setParameter(1, text1.getText());
    st.setParameter(2, p1.getText());

    ResultSet rs= st.executeQuery();
    if(rs.next())
     {
     //Login successfull.    
     }
    }

  catch (SQLException s){
    System.out.println("SQL statement is not executed!");
   }

  finally{
  rs.close();
  con.close();
}
origin: stackoverflow.com

 public class Test
{
  public static void main(String args[])
  {
    JTextField firstName = new JTextField();
    JTextField lastName = new JTextField();
    JPasswordField password = new JPasswordField();
    final JComponent[] inputs = new JComponent[]
    {
      new JLabel("First"),
      firstName,
      new JLabel("Last"),
      lastName,
      new JLabel("Password"),
      password        
    };
    int i = JOptionPane.showConfirmDialog(null, inputs, "My custom dialog",JOptionPane.PLAIN_MESSAGE);
    if(i == 0) System.out.println("You entered " + firstName.getText() + ", " + lastName.getText() + ", " + password.getText());
  }
}
origin: org.wikimedia/mwdumper

protected void onConnectButtonActionPerformed(java.awt.event.ActionEvent evt) {
  if (backend.connected)
    backend.disconnect();
  else
    backend.connect(dbtype, serverText.getText(),
      portText.getText(),
      userText.getText(),
      passwordText.getText());
}

origin: stackoverflow.com

 public class PasswordForm {
 private static String password = "mypass";
 public static void main(String[] args){
 //Swing operations should happen on the EDT
 EventQueue.invokeAndWait( new Runnable(){
    public void run(){
      //whole UI creation
      final JTextField usernameInput = new JTextField(10);
      final JPasswordField passwordInput = new JPasswordField(10);
      //more UI creation
      JButton loginInput = new JButton("Login");
      loginInput.addActionListener(new ActionListener(){
       public void actionPerformed(ActionEvent e){
        JOptionPane.showMessageDialog(null,"Username is:" + usernameInput.getText() + " Password is:" + passwordInput.getText());
       }
      });
    }
   } //todo catch the exceptions from the invokeAndWait call
 }
}
origin: FellowTraveler/otapij

  private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed

    // Save to server datastore

    String serverID = StorageHelper.addRippleServer(label,jTextField1.getText(),jTextField2.getText(),jPasswordField1.getText(),jTextField3.getText(),jTextField4.getText());
    if (Utility.VerifyStringVal(serverID)) {
      JOptionPane.showMessageDialog(null, "Ripple server added successflly","Ripple Server Addition",JOptionPane.INFORMATION_MESSAGE);
      MainPage.loadOtherTabServers();
    } else {
      JOptionPane.showMessageDialog(null, "Error creating bitcoin server", "Datastore error", JOptionPane.ERROR_MESSAGE);
    }

    dispose();
}//GEN-LAST:event_jButton1ActionPerformed

origin: FellowTraveler/otapij

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
  // Save to server datastore
 
  String serverID = StorageHelper.addBitcoinServer(label,jTextField2.getText(),jTextField1.getText(),jPasswordField1.getText(),jTextField3.getText());
  if (Utility.VerifyStringVal(serverID)) {
    JOptionPane.showMessageDialog(null, "Bitcoin server added successflly","Bitcoin Server Addition",JOptionPane.INFORMATION_MESSAGE);
    MainPage.loadOtherTabServers();
  } else {
    JOptionPane.showMessageDialog(null, "Error creating bitcoin server", "Datastore error", JOptionPane.ERROR_MESSAGE);
  }
  dispose();
}//GEN-LAST:event_jButton1ActionPerformed
origin: stackoverflow.com

final JPasswordField pass = new JPasswordField("Password");
 Font passFont = user.getFont();
 pass.setFont(passFont.deriveFont(Font.ITALIC));
 pass.setForeground(Color.GRAY);
 pass.setPreferredSize(new Dimension(150, 20));
 pass.setEchoChar((char)0);
 pass.addFocusListener(new FocusListener() {
   public void focusGained(FocusEvent e) {
     pass.setEchoChar('*');
     if (pass.getText().equals("Password")) {
       pass.setText("");
     }
   }
   public void focusLost(FocusEvent e) {
     if ("".equalsIgnoreCase(pass.getText().trim())) {
       pass.setEchoChar((char)0);
       pass.setText("Password");
     }
   }});
origin: SKCraft/Launcher

@SuppressWarnings("deprecation")
private void prepareLogin() {
  Object selected = idCombo.getSelectedItem();
  if (selected != null && selected instanceof Account) {
    Account account = (Account) selected;
    String password = passwordText.getText();
    if (password == null || password.isEmpty()) {
      SwingHelper.showErrorDialog(this, SharedLocale.tr("login.noPasswordError"), SharedLocale.tr("login.noPasswordTitle"));
    } else {
      if (rememberPassCheck.isSelected()) {
        account.setPassword(password);
      } else {
        account.setPassword(null);
      }
      if (rememberIdCheck.isSelected()) {
        accounts.add(account);
      } else {
        accounts.remove(account);
      }
      account.setLastUsed(new Date());
      Persistence.commitAndForget(accounts);
      attemptLogin(account, password);
    }
  } else {
    SwingHelper.showErrorDialog(this, SharedLocale.tr("login.noLoginError"), SharedLocale.tr("login.noLoginTitle"));
  }
}
origin: SKCraft/SKMCLauncher

private void prepareLogin() {
  Object selected = idCombo.getSelectedItem();
  if (selected != null && selected instanceof Account) {
    Account account = (Account) selected;
    String password = passwordText.getText();
    if (password == null || password.isEmpty()) {
      SwingHelper.showErrorDialog(this, _("loginDialog.missingPassword"), _("errors.errorTitle"));
    } else {
      if (rememberPassCheck.isSelected()) {
        account.setPassword(password);
      } else {
        account.setPassword(null);
      }
      if (rememberIdCheck.isSelected()) {
        accounts.add(account);
      } else {
        accounts.remove(account);
      }
      account.setLastUsed(new Date());
      Persistence.commitAndForget(accounts);
      attemptLogin(account, password);
    }
  } else {
    SwingHelper.showErrorDialog(this, _("loginDialog.missingId"), _("errors.errorTitle"));
  }
}
javax.swingJPasswordFieldgetText

Popular methods of JPasswordField

  • <init>
  • getPassword
  • setText
  • setEnabled
  • addActionListener
  • addKeyListener
  • setColumns
  • getDocument
  • setEchoChar
  • requestFocusInWindow
  • setEditable
  • setPreferredSize
  • setEditable,
  • setPreferredSize,
  • addFocusListener,
  • setFont,
  • setToolTipText,
  • setName,
  • getEchoChar,
  • requestFocus,
  • setDocument

Popular in Java

  • Updating database using SQL prepared statement
  • startActivity (Activity)
  • setScale (BigDecimal)
  • getSupportFragmentManager (FragmentActivity)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • Runner (org.openjdk.jmh.runner)
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now