Example usage for javax.swing JPasswordField JPasswordField

List of usage examples for javax.swing JPasswordField JPasswordField

Introduction

In this page you can find the example usage for javax.swing JPasswordField JPasswordField.

Prototype

public JPasswordField(Document doc, String txt, int columns) 

Source Link

Document

Constructs a new JPasswordField that uses the given text storage model and the given number of columns.

Usage

From source file:com.floreantpos.main.SetUpWindow.java

private JPanel createUserPanel() {
    JPanel userPanel = new JPanel(new MigLayout("fill,hidemode 3", "[150px][fill, grow]", "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    userPanel.setVisible(false);// ww w  . j a va  2s.c  o  m
    userPanel.setBorder(new TitledBorder(Messages.getString("SetUpWindow.16"))); //$NON-NLS-1$

    lblId = new JLabel();
    lblFirstName = new JLabel();
    lblLastName = new JLabel();
    lblSecretKey = new JLabel();
    lblConfirmSecretKey = new JLabel();
    tfPassword1 = new JPasswordField(new FixedLengthDocument(16), "", 5); //$NON-NLS-1$
    tfPassword2 = new JPasswordField(new FixedLengthDocument(16), "", 5); //$NON-NLS-1$
    tfUserId = new FixedLengthTextField();
    tfFirstName = new FixedLengthTextField();
    tfFirstName.setColumns(20);
    tfFirstName.setLength(30);
    tfLastName = new FixedLengthTextField();
    tfLastName.setLength(30);
    tfLastName.setColumns(20);

    lblId.setText("ID"); //$NON-NLS-1$
    userPanel.add(lblId, "aligny center"); //$NON-NLS-1$
    userPanel.add(tfUserId, "growx,aligny center,wrap"); //$NON-NLS-1$

    lblFirstName.setText("First Name"); //$NON-NLS-1$
    userPanel.add(lblFirstName, "aligny center"); //$NON-NLS-1$
    userPanel.add(tfFirstName, "growx,aligny center,split 3"); //$NON-NLS-1$

    lblLastName.setText("Last Name"); //$NON-NLS-1$
    userPanel.add(lblLastName, "aligny center"); //$NON-NLS-1$
    userPanel.add(tfLastName, "growx,aligny ,w 200!,center,wrap"); //$NON-NLS-1$

    lblSecretKey.setText("Secret Key"); //$NON-NLS-1$
    userPanel.add(lblSecretKey, "aligny center"); //$NON-NLS-1$
    userPanel.add(tfPassword1, "growx,aligny center,split 3"); //$NON-NLS-1$

    lblConfirmSecretKey.setText("Confirm Secret Key"); //$NON-NLS-1$
    userPanel.add(lblConfirmSecretKey, "aligny center"); //$NON-NLS-1$
    userPanel.add(tfPassword2, "growx,w 200!,aligny center"); //$NON-NLS-1$

    return userPanel;
}