private void initComponents()

in taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/NewEditPasswordEntryDialog.java [136:276]


	private void initComponents() {
		getContentPane().setLayout(new BorderLayout());

        JLabel serviceURILabel = new JLabel("Service URI");
        serviceURILabel.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));

        JLabel passwordConfirmLabel = new JLabel("Confirm password");
        passwordConfirmLabel.setBorder(new EmptyBorder(0,5,0,0));

        serviceURIField = new JTextField();
        //jtfServiceURI.setBorder(new EmptyBorder(0,0,0,5));

        usernameField = new JTextField(15);
        //jtfUsername.setBorder(new EmptyBorder(0,0,0,5));

        passwordField = new JPasswordField(15);
        //jpfFirstPassword.setBorder(new EmptyBorder(0,0,0,5));

        passwordConfirmField = new JPasswordField(15);
        //jpfConfirmPassword.setBorder(new EmptyBorder(0,0,0,5));

        //If in EDIT_MODE - populate the fields with current values
		if (mode.equals(EDIT_MODE)) {
			serviceURIField.setText(serviceURI.toASCIIString());
			usernameField.setText(username);
			passwordField.setText(password);
			passwordConfirmField.setText(password);
		}

		JButton okButton = new JButton("OK");
		okButton.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent evt) {
				okPressed();
			}
		});

		JButton cancelButton = new JButton("Cancel");
		cancelButton.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent evt) {
				cancelPressed();
			}
		});

		JPanel passwordPanel = 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);
        passwordPanel.add(serviceURILabel, 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);
        passwordPanel.add(serviceURIField, 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);
        passwordPanel.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);
        passwordPanel.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);
        passwordPanel.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);
        passwordPanel.add(passwordField, gbc);

		gbc.weightx = 0.0;
		gbc.gridx = 0;
		gbc.gridy = 3;
		gbc.fill = NONE;
		gbc.anchor = WEST;
		gbc.insets = new Insets(5, 10, 0, 0);
        passwordPanel.add(passwordConfirmLabel, gbc);

		gbc.weightx = 1.0;
		gbc.gridx = 1;
		gbc.gridy = 3;
		gbc.fill = HORIZONTAL;
		gbc.anchor = WEST;
		gbc.insets = new Insets(5, 10, 0, 5);
		passwordPanel.add(passwordConfirmField, gbc);

		passwordPanel.setBorder(new CompoundBorder(new EmptyBorder(10, 10, 10,
				10), new EtchedBorder()));

		JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
		buttonsPanel.add(okButton);
		buttonsPanel.add(cancelButton);

		getContentPane().add(passwordPanel, CENTER);
		getContentPane().add(buttonsPanel, SOUTH);

		addWindowListener(new WindowAdapter() {
			@Override
			public void windowClosing(WindowEvent evt) {
				closeDialog();
			}
		});

        //setResizable(false);
        getRootPane().setDefaultButton(okButton);
        pack();
    }