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

How to use
setEchoChar
method
in
javax.swing.JPasswordField

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

origin: kaikramer/keystore-explorer

/**
 * Set echo character.
 *
 * @param c
 *            Echo character
 */
public void setEchoChar(char c) {
  jpfPassword.setEchoChar(c);
}
origin: sonar-intellij-plugin/sonar-intellij-plugin

private void makePasswordInvisible() {
 myPasswordField.setEchoChar('•');
}
origin: sonar-intellij-plugin/sonar-intellij-plugin

private void makePasswordVisible() {
 myPasswordField.setEchoChar('\u0000');
}
origin: org.zaproxy/zap

  @Override
  public void actionPerformed(java.awt.event.ActionEvent e) {    
    if (chkShowPassword.isSelected()) {
      txtProxyChainPassword.setEchoChar((char) 0);
    } else {
      txtProxyChainPassword.setEchoChar('*');
    }
  }
});
origin: org.zaproxy/zap

  @Override
  public void actionPerformed(java.awt.event.ActionEvent e) {    
    if (chkShowPassword.isSelected()) {
      txtProxyChainPassword.setEchoChar((char) 0);
    } else {
      txtProxyChainPassword.setEchoChar('*');
    }
  }
});
origin: net.sourceforge.jadex/jadex-runtimetools-swing

  public void stateChanged(ChangeEvent e)
  {
    tfpass.setEchoChar(cbshowchars.isSelected() ? 0 : echo);
  }
});
origin: org.activecomponents.jadex/jadex-runtimetools-swing

  public void stateChanged(ChangeEvent e)
  {
    tfpass.setEchoChar(cbshowchars.isSelected() ? 0 : echo);
  }
});
origin: stackoverflow.com

 JPasswordField password = new JPasswordField(15);
{
 password.setEchoChar('%');
}
origin: stackoverflow.com

 JPasswordField p1=new JPasswordField("pass",6);
p1.setEchoChar('*');
top.add(p1);
origin: stackoverflow.com

 JPasswordField user = new JPasswordField(10);
user.setEchoChar('?');
panel.add(user);
origin: org.netbeans.modules/org-netbeans-modules-docker-ui

private void showPasswordCheckBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_showPasswordCheckBoxItemStateChanged
  if (showPasswordCheckBox.isSelected()) {
    passwordPasswordField.setEchoChar((char) 0);
  } else {
    passwordPasswordField.setEchoChar(reference.getEchoChar());
  }
}//GEN-LAST:event_showPasswordCheckBoxItemStateChanged
origin: Multibit-Legacy/multibit-hd

@Override
public void actionPerformed(ActionEvent e) {
 JButton button = (JButton) e.getSource();
 if (asClearText) {
  ButtonDecorator.applyShow(button);
 } else {
  ButtonDecorator.applyHide(button);
 }
 asClearText = !asClearText;
 if (asClearText) {
  // Reveal
  password1.setEchoChar('\0');
  password2.setEchoChar('\0');
 } else {
  // Use the platform choice
  password1.setEchoChar(echoChar);
  password2.setEchoChar(echoChar);
 }
}
origin: net.java.openjdk.cacio/cacio-shared

@Override
public void setEchoChar(char echoChar) {
  
  getSwingComponent().setEchoChar(echoChar);
}
origin: BranislavLazic/SwingTutorials

public JPasswordFieldTutorial() {
  button.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      char [] input = passwordField.getPassword();
      if(checkIfCorrect(input)) {
        JOptionPane.showMessageDialog(null,"Password is correct!");
      } else {
        JOptionPane.showMessageDialog(null,"Password is incorrect!");
      }
    }
  });
  passwordField.setEchoChar('*');
  panel.add(passwordField);
  panel.add(button);
  frame.add(panel);
  frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  frame.pack();
  frame.setVisible(true);
}
origin: Multibit-Legacy/multibit-hd

@Override
public void actionPerformed(ActionEvent e) {
 JButton button = (JButton) e.getSource();
 if (asClearText) {
  ButtonDecorator.applyShow(button);
 } else {
  ButtonDecorator.applyHide(button);
 }
 asClearText = !asClearText;
 if (asClearText) {
  // Reveal
  password.setEchoChar('\0');
 } else {
  // Use the platform choice
  password.setEchoChar(echoChar);
 }
}
origin: org.netbeans.modules/org-netbeans-modules-tomcat5

private void showButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showButtonActionPerformed
  if (!passwordVisible) {
    passwordVisible = true;
    originalFont = passwordField.getFont();
    passwordField.setFont(usernameTextField.getFont());
    originalEchoChar = passwordField.getEchoChar();
    passwordField.setEchoChar((char) 0);
    Mnemonics.setLocalizedText(showButton, NbBundle.getMessage(CustomizerGeneral.class, "LBL_ShowButtonHide"));
    showButton.setToolTipText(NbBundle.getMessage(CustomizerGeneral.class, "LBL_ShowButtonHide_ToolTip"));
  } else {
    passwordVisible = false;
    passwordField.setFont(originalFont);
    passwordField.setEchoChar(originalEchoChar);
    Mnemonics.setLocalizedText(showButton, NbBundle.getMessage(CustomizerGeneral.class, "CustomizerGeneral.showButton.text"));
    showButton.setToolTipText(NbBundle.getMessage(CustomizerGeneral.class, "CustomizerGeneral.showButton.toolTipText"));
    
  }
}//GEN-LAST:event_showButtonActionPerformed

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: stackoverflow.com

 private JPasswordField password;
  private String typedPassword;
  private final String defaultPassword = "yourDesiredPassword";

  public void createPasswordField(){

  password = new JPasswordField(30);
  password.setBounds(280, 240, 90, 20);
  password.setEchoChar('*');
  password.setBackground(Color.white);
  password.addActionListener(new ActionListener() {

    @Override
    public void actionPerformed(ActionEvent e) {

      password = (JPasswordField) e.getSource();
      char [] tempPass = password.getPassword();
      typedPassword = new String(tempPass);

      if (!typedPassword.equals(defaultPassword)){

        JOptionPane.showMessageDialog(null,
      "Your password is not correct",
      "Stack Over Flow example",
      JOptionPane.ERROR_MESSAGE);
      }
    }
  });
}
origin: org.zaproxy/zap

@Override
public void initParam(Object obj) {
  
  OptionsParam optionsParam = (OptionsParam) obj;
  ConnectionParam connectionParam = optionsParam.getConnectionParam();
  
  // set Proxy Chain parameters
  txtProxyChainRealm.setText(connectionParam.getProxyChainRealm());
  txtProxyChainRealm.discardAllEdits();
  txtProxyChainUserName.setText(connectionParam.getProxyChainUserName());
  txtProxyChainUserName.discardAllEdits();
  chkShowPassword.setSelected(false);//Default don't show (everytime)
  txtProxyChainPassword.setEchoChar('*');//Default mask (everytime)
  this.proxyDialog.pack();
}
origin: net.java.openjdk.cacio/cacio-shared

@Override
JPasswordField initSwingComponent() {
  
  TextField textField = getAWTComponent();
  JPasswordField swingComponent = new JPasswordField();
  swingComponent.setText(textField.getText());
  swingComponent.setColumns(textField.getColumns());
  swingComponent.setEchoChar(textField.getEchoChar());
  swingComponent.setEditable(textField.isEditable());
  swingComponent.select(textField.getSelectionStart(),
             textField.getSelectionEnd());
  
  swingComponent.addActionListener(new SwingTextFieldListener());
  return swingComponent;
}

javax.swingJPasswordFieldsetEchoChar

Popular methods of JPasswordField

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

Popular in Java

  • Start an intent from android
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • findViewById (Activity)
  • getSupportFragmentManager (FragmentActivity)
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Top Vim plugins
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