Codota Logo
JPasswordField
Code IndexAdd Codota to your IDE (free)

How to use
JPasswordField
in
javax.swing

Best Java code snippets using javax.swing.JPasswordField (Showing top 20 results out of 2,268)

Refine searchRefine arrow

  • JTextField
  • JLabel
  • JPanel
  • JButton
  • Container
  • Common ways to obtain JPasswordField
private void myMethod () {
JPasswordField j =
  • Codota Iconnew JPasswordField()
  • Codota Iconnew JPasswordField(int1)
  • Codota IconString str;new JPasswordField(str)
  • Smart code suggestions by Codota
}
origin: stackoverflow.com

setLayout(new GridBagLayout()); 
JLabel usrNameLabel = new JLabel("User Name");
changeCompFont(usrNameLabel);
JTextField usrNameFeild = new JTextField("user name");
changeCompFont(usrNameFeild);
usrNameLabel.setLabelFor(usrNameFeild);
JLabel passwordLabel = new JLabel("Password");
changeCompFont(passwordLabel);
JPasswordField passFeild = new JPasswordField("Password");
changeCompFont(passFeild);
passFeild.setBorder(compundBorder);
add(usrNameLabel, labCnst);
add(usrNameFeild, txtCnst);
origin: stackoverflow.com

 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));
}
origin: wiztools/rest-client

@Override
public void clear() {
  jcb_types.setSelectedItem(AuthHelper.NONE);
  
  jcb_preemptive.setSelected(false);
  
  jtf_host.setText("");
  jtf_realm.setText("");
  jtf_domain.setText("");
  jtf_workstation.setText("");
  jtf_username.setText("");
  jpf_password.setText("");
  jtf_ntlm_username.setText("");
  jpf_ntlm_password.setText("");
  jtf_bearer_token.setText("");
}
origin: stackoverflow.com

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

JPanel p = new JPanel(new BorderLayout(5,5));
JPanel labels = new JPanel(new GridLayout(0,1,2,2));
labels.add(new JLabel("User Name", SwingConstants.RIGHT));
labels.add(new JLabel("Password", SwingConstants.RIGHT));
p.add(labels, BorderLayout.WEST);
JPanel controls = new JPanel(new GridLayout(0,1,2,2));
JTextField username = new JTextField("Joe Blogs");
controls.add(username);
JPasswordField password = new JPasswordField();
password.addAncestorListener(new RequestFocusListener(false));
controls.add(password);
origin: magefree/mage

lblBattlefieldFeedbackColorizingMode = new javax.swing.JLabel();
sliderFontSize = new javax.swing.JSlider();
fontSizeLabel = new javax.swing.JLabel();
txtImageFolderPath = new javax.swing.JTextField();
btnBrowseImageLocation = new javax.swing.JButton();
cbCheckForNewImages = new javax.swing.JCheckBox();
cbSaveToZipFiles = new javax.swing.JCheckBox();
txtBackgroundImagePath = new javax.swing.JTextField();
btnBrowseBackgroundImage = new javax.swing.JButton();
txtBattlefieldImagePath = new javax.swing.JTextField();
btnBrowseBattlefieldImage = new javax.swing.JButton();
cbUseDefaultBattleImage = new javax.swing.JCheckBox();
cbUseRandomBattleImage = new javax.swing.JCheckBox();
txtPasswordField = new javax.swing.JPasswordField();
txtPasswordField.addActionListener(new java.awt.event.ActionListener() {
  public void actionPerformed(java.awt.event.ActionEvent evt) {
    txtPasswordFieldActionPerformed(evt);
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
  layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
origin: magefree/mage

lblServer = new javax.swing.JLabel();
lblUserName = new javax.swing.JLabel();
txtUserName = new javax.swing.JTextField();
lblPassword = new javax.swing.JLabel();
txtPassword = new javax.swing.JPasswordField();
chkForceUpdateDB = new javax.swing.JCheckBox();
jProxySettingsButton = new javax.swing.JButton();
btnConnect = new javax.swing.JButton();
btnCancel = new javax.swing.JButton();
panelFlag = new javax.swing.JPanel();
cbFlag = new mage.client.util.gui.countryBox.CountryComboBox();
panelFast = new javax.swing.JPanel();
panelServer = new javax.swing.JPanel();
txtServer = new javax.swing.JTextField();
txtPort = new javax.swing.JTextField();
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
origin: magefree/mage

txtServer = new javax.swing.JTextField();
lblServer = new javax.swing.JLabel();
lblPort = new javax.swing.JLabel();
txtPort = new javax.swing.JTextField();
btnConnect = new javax.swing.JButton();
btnCancel = new javax.swing.JButton();
chkAutoConnect = new javax.swing.JCheckBox();
jButton1 = new javax.swing.JButton();
cbProxyType = new javax.swing.JComboBox();
lblProxyType = new javax.swing.JLabel();
pnlProxySettings = new javax.swing.JPanel();
pnlProxy = new javax.swing.JPanel();
lblProxyServer = new javax.swing.JLabel();
txtProxyServer = new javax.swing.JTextField();
lblProxyPort = new javax.swing.JLabel();
txtProxyPort = new javax.swing.JTextField();
pnlProxyAuth = new javax.swing.JPanel();
lblProxyUserName = new javax.swing.JLabel();
txtProxyUserName = new javax.swing.JTextField();
lblProxyPassword = new javax.swing.JLabel();
txtPasswordField = new javax.swing.JPasswordField();
lblPassword = new javax.swing.JLabel();
txtPassword = new javax.swing.JPasswordField();
lblStatus = new javax.swing.JLabel();
lblProxyPassword.setText("Password:");
txtPasswordField.addActionListener(evt -> txtPasswordFieldActionPerformed(evt));
origin: magefree/mage

jPanel2 = new javax.swing.JPanel();
jLabel6 = new javax.swing.JLabel();
lblAuthToken = new javax.swing.JLabel();
lblPassword = new javax.swing.JLabel();
lblPasswordConfirmation = new javax.swing.JLabel();
txtAuthToken = new javax.swing.JTextField();
btnSubmitNewPassword = new javax.swing.JButton();
lblPasswordConfirmationReasoning = new javax.swing.JLabel();
txtPassword = new javax.swing.JPasswordField();
txtPasswordConfirmation = new javax.swing.JPasswordField();
jPanel1 = new javax.swing.JPanel();
jLabel5 = new javax.swing.JLabel();
lblEmail = new javax.swing.JLabel();
txtEmail = new javax.swing.JTextField();
btnGetAuthToken = new javax.swing.JButton();
lblStatus = new javax.swing.JLabel();
btnCancel = new javax.swing.JButton();
lblServer = new javax.swing.JLabel();
txtServer = new javax.swing.JTextField();
txtPort = new javax.swing.JTextField();
lblPort = new javax.swing.JLabel();
setTitle("Reset password");
jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder());
jLabel6.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
origin: runelite/runelite

topPanel.removeAll();
mainPanel.removeAll();
topPanelBackButton.addActionListener(e -> openConfigList());
topPanelBackButton.setToolTipText("Back");
topPanel.add(topPanelBackButton, BorderLayout.WEST);
topPanel.add(listItem.createToggleButton(), BorderLayout.EAST);
JLabel title = new JLabel(name);
title.setForeground(Color.WHITE);
title.setToolTipText("<html>" + name + ":<br>" + listItem.getDescription() + "</html>");
topPanel.add(title);
      textField = new JPasswordField();
      colorPickerBtn = new JButton("Pick a color");
      colorPickerBtn = new JButton(ColorUtil.toHexColor(existingColor).toUpperCase());
    colorPickerBtn.setFocusable(false);
    colorPickerBtn.setBackground(existingColor);
    colorPickerBtn.addMouseListener(new MouseAdapter()
origin: bedatadriven/activityinfo

public void show(final Callback callback) {
  // Basic form create
  final JDialog frame = new JDialog();
  frame.setTitle("Login");
  frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
  frame.setSize(300,150);
  // Creating the grid
  JPanel panel = new JPanel(new MigLayout());
  frame.getContentPane().add(panel, BorderLayout.NORTH);
  usernameInput = new JTextField(25);
  passwordInput = new JPasswordField(25);
  panel.add(new JLabel("Email:"));
  panel.add(usernameInput, "wrap");
  panel.add(new JLabel("Password:"));
  panel.add(passwordInput, "wrap");
  JButton loginInput = new JButton("Login");
  loginInput.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent actionEvent) {
      frame.setVisible(false);
      callback.ok(usernameInput.getText(), new String(passwordInput.getPassword()));
    }
  });
  panel.add(loginInput);
  frame.setVisible(true);
}
origin: magefree/mage

lblServer = new javax.swing.JLabel();
lblPort = new javax.swing.JLabel();
lblUserName = new javax.swing.JLabel();
lblPassword = new javax.swing.JLabel();
txtUserName = new javax.swing.JTextField();
txtPassword = new javax.swing.JPasswordField();
btnRegister = new javax.swing.JButton();
btnCancel = new javax.swing.JButton();
lblStatus = new javax.swing.JLabel();
txtServer = new javax.swing.JTextField();
txtPort = new javax.swing.JTextField();
txtEmail = new javax.swing.JTextField();
lblPasswordConfirmation = new javax.swing.JLabel();
txtPasswordConfirmation = new javax.swing.JPasswordField();
lblEmail = new javax.swing.JLabel();
lblPasswordConfirmationReasoning = new javax.swing.JLabel();
txtUserName.addActionListener(evt -> txtUserNameActionPerformed(evt));
btnRegister.setText("Register");
btnRegister.addActionListener(evt -> btnRegisterActionPerformed(evt));
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
origin: hyperion-project/hypercon

private JPanel getConnectionPanel() {
  if (mConnectionPanel == null) {
    mConnectionPanel = new JPanel();
    mConnectionPanel.setLayout(new GridLayout(0, 2));
    mConnectionPanel.setBorder(BorderFactory.createTitledBorder("SSH Connection"));
    mIpLabel = new JLabel("IP address: ");
    mConnectionPanel.add(mIpLabel);
    mIpField = new JTextField("192.168.1.17");
    mConnectionPanel.add(mIpField);
    mUsernameLabel = new JLabel("Username: ");
    mConnectionPanel.add(mUsernameLabel);
    mUsernameField = new JTextField("pi");
    mConnectionPanel.add(mUsernameField);
    mPasswordLabel = new JLabel("Password: ");
    mConnectionPanel.add(mPasswordLabel);
    mPasswordField = new JPasswordField("raspberry");
    mConnectionPanel.add(mPasswordField);
    mConnectionPanel.add(new JLabel(""));
    mTestConnectionButton = new JButton(mConnectAction);
    mConnectionPanel.add(mTestConnectionButton);
origin: alibaba/jstorm

                   String[] prompt,
                   boolean[] echo) {
panel = new JPanel();
panel.setLayout(new GridBagLayout());
panel.add(new JLabel(instruction), gbc);
gbc.gridy++;
  gbc.gridx = 0;
  gbc.weightx = 1;
  panel.add(new JLabel(prompt[i]), gbc);
  gbc.weighty = 1;
  if (echo[i]) {
    texts[i] = new JTextField(20);
  } else {
    texts[i] = new JPasswordField(20);
  panel.add(texts[i], gbc);
  String[] response = new String[prompt.length];
  for (int i = 0; i < prompt.length; i++) {
    response[i] = texts[i].getText();
origin: org.apache.jmeter/ApacheJMeter_http

  private JPanel getProxyPassPanel() {
    proxyPass = new JPasswordField(5);

    JLabel label = new JLabel(JMeterUtils.getResString("password")); // $NON-NLS-1$
    label.setLabelFor(proxyPass);
    label.setFont(FONT_SMALL);

    JPanel panel = new JPanel(new BorderLayout(5, 0));
    panel.add(label, BorderLayout.WEST);
    panel.add(proxyPass, BorderLayout.CENTER);
    return panel;
  }
}
origin: openmrs/openmrs-core

  message = "Enter username/password to authenticate to OpenMRS...";
JPanel panel = new JPanel(new GridBagLayout());
JLabel usernameLabel = new JLabel("Username");
usernameLabel.setFont(font);
usernameField = new JTextField(20);
usernameField.setFont(font);
JLabel passwordLabel = new JLabel("Password");
passwordLabel.setFont(font);
JPasswordField passwordField = new JPasswordField(20);
passwordField.setFont(font);
panel.add(usernameLabel, new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.EAST,
    GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 5, 0));
panel.add(usernameField, new GridBagConstraints(1, 0, 1, 1, 0, 0, GridBagConstraints.WEST,
    GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
panel.add(passwordLabel, new GridBagConstraints(0, 1, 1, 1, 0, 0, GridBagConstraints.EAST,
return (response == 2 || response == -1 ? null : new String[] { usernameField.getText(),
    String.valueOf(passwordField.getPassword()) });
origin: stackoverflow.com

 import javax.swing.*;
import java.awt.*;

public class MyMain {
  public static void main (String args []) {
    JFrame login = new JFrame("Login window");
    JTextField user = new JTextField("Username");
    JPasswordField password = new JPasswordField("Password");
    JButton loginButton = new JButton("Login");


    login.setLayout(new BorderLayout());
    login.add(user, BorderLayout.NORTH);
    login.add(password, BorderLayout.CENTER);
    login.add(loginButton, BorderLayout.SOUTH);

    login.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    login.setSize(800,600);
    login.setVisible(true);

  }
}
origin: stackoverflow.com

public void createPage1() {
   panel1 = new JPanel();
   panel1.setLayout(null);
   JLabel label1 = new JLabel("Username:");
   label1.setBounds(10, 15, 150, 20);
   panel1.add(label1);
   JTextField field = new JTextField();
   field.setBounds(10, 35, 150, 20);
   panel1.add(field);
   JLabel label2 = new JLabel("Password:");
   label2.setBounds(10, 60, 150, 20);
   panel1.add(label2);
   JPasswordField fieldPass = new JPasswordField();
   fieldPass.setBounds(10, 80, 150, 20);
   panel1.add(fieldPass);
    JButton login=new JButton("login");
    login.setBounds(10, 120, 80, 25);
    panel1.add(login);
    login.addActionListener(new ActionListener() {
     @Override
     public void actionPerformed(ActionEvent e) {
     panel4=new JPanel();    
     //panel4.setLayout(null);
     panel4.add(new JLabel("welcome buddy"));
     tabbedPane.addTab("Page 4", panel4);
     }
   });
 }
origin: igvteam/igv

private void init() {
  passPanel = new JPanel();
  passPanel.setLayout(new GridLayout(6, 1));
  JLabel message = new JLabel("Please enter your username and password for:");
  JLabel location = new JLabel(StringUtils.checkLength(resourceString, 80));
  JLabel username = new JLabel("User:");
  JLabel password = new JLabel("Pass:");
  userField = new JTextField();
  passwordField = new JPasswordField();
  passPanel.add(message);
  passPanel.add(location);
  passPanel.add(username);
  passPanel.add(userField);
  passPanel.add(password);
  passPanel.add(passwordField);
}
javax.swingJPasswordField

Most used methods

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

Popular in Java

  • Creating JSON documents from java classes using gson
  • scheduleAtFixedRate (ScheduledExecutorService)
  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • getExternalFilesDir (Context)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • JList (javax.swing)
  • 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,
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now