JComponent () { JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); GridBagConstraints gb = new GridBagConstraints(); // top label. gb.insets = JBUI.insets(2); gb.weightx = 1; gb.weighty = 0; gb.gridwidth = 2; gb.gridheight = 1; gb.gridx = 0; gb.gridy = 0; gb.anchor = GridBagConstraints.WEST; gb.fill = GridBagConstraints.HORIZONTAL; JLabel label = new JLabel(SvnBundle.message("label.auth.authentication.realm", myRealm)); panel.add(label, gb); // user name gb.gridy += 1; gb.gridwidth = 1; gb.weightx = 0; gb.fill = GridBagConstraints.NONE; label = new JLabel(SvnBundle.message(myMode.equals(Mode.SSH_PASSPHRASE) ? "label.ssh.key.file" : "label.auth.user.name")); panel.add(label, gb); // user name field gb.gridx = 1; gb.weightx = 1; gb.fill = GridBagConstraints.HORIZONTAL; myUserNameText = new JTextField(); panel.add(myUserNameText, gb); label.setLabelFor(myUserNameText); if (myUserName != null) { myUserNameText.setText(myUserName); } myUserNameText.selectAll(); myUserNameText.getDocument().addDocumentListener(this); myUserNameText.setEnabled(myMode.equals(Mode.DEFAULT)); gb.gridy += 1; gb.weightx = 0; gb.gridx = 0; gb.fill = GridBagConstraints.NONE; gb.gridwidth = 1; label = new JLabel(SvnBundle.message(myMode.equals(Mode.SSH_PASSPHRASE) ? "label.ssh.passphrase" : "label.auth.password")); panel.add(label, gb); // passworde field gb.gridx = 1; gb.weightx = 1; gb.fill = GridBagConstraints.HORIZONTAL; myPasswordText = new JPasswordField(); panel.add(myPasswordText, gb); label.setLabelFor(myPasswordText); gb.gridy += 1; gb.gridx = 0; gb.gridwidth = 2; gb.weightx = 1; gb.fill = GridBagConstraints.HORIZONTAL; myAllowSaveCheckBox = new JCheckBox(SvnBundle.message("checkbox.auth.keep.for.current.session")); panel.add(myAllowSaveCheckBox, gb); gb.gridy += 1; if (! myAllowSave) { final JLabel cannotSaveLabel = new JLabel(SvnBundle.message("svn.cannot.save.credentials.store-auth-creds")); cannotSaveLabel.setForeground(NamedColorUtil.getInactiveTextColor()); panel.add(cannotSaveLabel, gb); gb.gridy += 1; } panel.add(new JSeparator(), gb); myAllowSaveCheckBox.setSelected(false); myAllowSaveCheckBox.setEnabled(myAllowSave); return panel; }