in taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/ViewUsernamePasswordEntryDialog.java [86:189]
private void initComponents() {
getContentPane().setLayout(new BorderLayout());
JLabel serviceURLLabel = new JLabel("Service URL");
serviceURLLabel.setBorder(new EmptyBorder(0, 5, 0, 0));
JLabel usernameLabel = new JLabel("Username");
usernameLabel.setBorder(new EmptyBorder(0, 5, 0, 0));
JLabel passwordLabel = new JLabel("Password");
passwordLabel.setBorder(new EmptyBorder(0, 5, 0, 0));
// Populate the fields with values and disable user input
serviceURLField = new JTextField();
serviceURLField.setText(serviceURL);
serviceURLField.setEditable(false);
usernameField = new JTextField(15);
usernameField.setText(username);
usernameField.setEditable(false);
passwordField = new JTextField(15);
passwordField.setText(password);
passwordField.setEditable(false);
JButton okButton = new JButton("OK");
okButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
closeDialog();
}
});
JPanel fieldsPanel = new JPanel(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.weighty = 0.0;
gbc.weightx = 0.0;
gbc.gridx = 0;
gbc.gridy = 0;
gbc.fill = NONE;
gbc.anchor = WEST;
gbc.insets = new Insets(5, 10, 0, 0);
fieldsPanel.add(serviceURLLabel, gbc);
gbc.weightx = 1.0;
gbc.gridx = 1;
gbc.gridy = 0;
gbc.fill = HORIZONTAL;
gbc.anchor = WEST;
gbc.insets = new Insets(5, 10, 0, 5);
fieldsPanel.add(serviceURLField, gbc);
gbc.weightx = 0.0;
gbc.gridx = 0;
gbc.gridy = 1;
gbc.fill = NONE;
gbc.anchor = WEST;
gbc.insets = new Insets(5, 10, 0, 0);
fieldsPanel.add(usernameLabel, gbc);
gbc.weightx = 1.0;
gbc.gridx = 1;
gbc.gridy = 1;
gbc.fill = HORIZONTAL;
gbc.anchor = WEST;
gbc.insets = new Insets(5, 10, 0, 5);
fieldsPanel.add(usernameField, gbc);
gbc.weightx = 0.0;
gbc.gridx = 0;
gbc.gridy = 2;
gbc.fill = NONE;
gbc.anchor = WEST;
gbc.insets = new Insets(5, 10, 0, 0);
fieldsPanel.add(passwordLabel, gbc);
gbc.weightx = 1.0;
gbc.gridx = 1;
gbc.gridy = 2;
gbc.fill = HORIZONTAL;
gbc.anchor = WEST;
gbc.insets = new Insets(5, 10, 0, 5);
fieldsPanel.add(passwordField, gbc);
fieldsPanel.setBorder(new CompoundBorder(
new EmptyBorder(10, 10, 10, 10), new EtchedBorder()));
JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
buttonsPanel.add(okButton);
getContentPane().add(fieldsPanel, CENTER);
getContentPane().add(buttonsPanel, SOUTH);
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent evt) {
closeDialog();
}
});
// setResizable(false);
getRootPane().setDefaultButton(okButton);
pack();
}