public PasswdDialog(String title, boolean userDisabled,
                      String userName, boolean passwdDisabled) {
    super(true);
    setResizable(false);
    setTitle(title);
    addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent e) {
        endDialog();
      }
    });

    JPanel p1 = new JPanel();
    userLabel = new JLabel("User name:");
    p1.add(userLabel);
    userEntry = new JTextField(30);
    userEntry.setEnabled(!userDisabled);
    userLabel.setEnabled(!userDisabled);
    if (userName != null)
      userEntry.setText(userName);
    p1.add(userEntry);
    userEntry.addKeyListener(this);

    JPanel p2 = new JPanel();
    passwdLabel = new JLabel("Password:");
    passwdLabel.setPreferredSize(userLabel.getPreferredSize());
    p2.add(passwdLabel);
    passwdEntry = new JPasswordField(30);
    passwdEntry.setEnabled(!passwdDisabled);
    passwdLabel.setEnabled(!passwdDisabled);
    p2.add(passwdEntry);
    passwdEntry.addKeyListener(this);

    getContentPane().setLayout(new BoxLayout(getContentPane(),
                                             BoxLayout.Y_AXIS));
    getContentPane().add(p1);
    getContentPane().add(p2);
    pack();
    if (userEntry.isEnabled() && userName == null) {
      userEntry.requestFocus();
    } else {
      passwdEntry.requestFocus();
    }
  }