private void buildPanel() {

		JPanel topPanel = new JPanel(new PairLayout(5, 10, 160));
		topPanel.setBorder(
			new CompoundBorder(new TitledBorder("External Program"), new EmptyBorder(0, 5, 5, 5)));

		topPanel.add(new GLabel("Name:", SwingConstants.RIGHT));
		extLibNameComboBox = new GhidraComboBox<>();
		extLibNameComboBox.setEditable(true);
		nameDocumentListener = new DocumentListener() {
			@Override
			public void changedUpdate(DocumentEvent e) {
				// Do nothing.
			}

			@Override
			public void insertUpdate(DocumentEvent e) {
				extProgNameChanged();
			}

			@Override
			public void removeUpdate(DocumentEvent e) {
				extProgNameChanged();
			}
		};
		extLibNameComboBox.addDocumentListener(nameDocumentListener);
		nameItemListener = e -> {
			extProgNameChanged();
			updateExtLibPath();
		};
		extLibNameComboBox.addItemListener(nameItemListener);
		topPanel.add(extLibNameComboBox);

		extLibPathTextField = new JTextField();
		extLibPathTextField.setBackground(getBackground());
		extLibPathTextField.setEditable(false);
		extLibPathTextField.setFocusable(false);

		clearButton = new JButton("Clear");
		clearButton.setToolTipText("Remove Link to External Program");
		clearButton.addActionListener(e -> extLibPathTextField.setText(null));

		editButton = new JButton("Edit");
		editButton.setToolTipText("Edit Link to External Program");
		editButton.addActionListener(e -> popupProgramChooser());

		JPanel pathPanel = new JPanel(new BorderLayout());
		pathPanel.add(extLibPathTextField, BorderLayout.CENTER);

		JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
		buttonPanel.add(clearButton);
		buttonPanel.add(editButton);
		pathPanel.add(buttonPanel, BorderLayout.EAST);

		topPanel.add(new GLabel("Path:", SwingConstants.RIGHT));
		topPanel.add(pathPanel);

		JPanel bottomPanel = new JPanel(new PairLayout(10, 10, 160));
		bottomPanel.setBorder(
			new CompoundBorder(new TitledBorder("External Location"), new EmptyBorder(0, 5, 5, 5)));

		bottomPanel.add(new GLabel("Type:", SwingConstants.RIGHT));

		extTypeLabel = new GDLabel("Function");
		bottomPanel.add(extTypeLabel);

		bottomPanel.add(new GDLabel("Label:", SwingConstants.RIGHT));
		extLabelTextField = new JTextField();
		bottomPanel.add(extLabelTextField);

		bottomPanel.add(new GLabel("Address:", SwingConstants.RIGHT));
		extAddressInputWidget = new AddressInput();
		bottomPanel.add(extAddressInputWidget);

		if (startingOriginalName != null) {
			bottomPanel.add(new GLabel("Original Label:", SwingConstants.RIGHT));
			bottomPanel.add(buildOriginalLableFieldAndRestoreButton());
		}

		setLayout(new VerticalLayout(5));
		add(topPanel);
		add(bottomPanel);

		if (externalLocation == null) {
			functionCheckBox = new GCheckBox("Make External Function");
			add(functionCheckBox);
		}
	}
Creates an external location or external function.
@param program the program to which the new external location will be added
@param externalLibraryName the name of the external library that the dialog should use
by default.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/symboltree/EditExternalLocationPanel.java