protected JPanel buildMainPanel() {

		// Create the individual components that make up the panel.
		archiveLabel = new GDLabel(" Archive File ");
		archiveLabel.getAccessibleContext().setAccessibleName("Archive File");
		archiveField = new JTextField();
		archiveField.setColumns(NUM_TEXT_COLUMNS);
		archiveField.setName("archiveField");
		archiveField.getAccessibleContext().setAccessibleName("Archive");

		archiveBrowse = new JButton(ArchivePlugin.DOT_DOT_DOT);
		archiveBrowse.setName("archiveButton");
		archiveBrowse.getAccessibleContext().setAccessibleName("Archive");
		archiveBrowse.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {

				String archivePath = chooseArchiveFile("Choose archive file",
					"Selects the project archive file to restore.");

				if ((archivePath != null) && (!archivePath.equals(""))) {
					// Make sure the archive has the correct suffix.
					if (!archivePath.endsWith(ArchivePlugin.ARCHIVE_EXTENSION)) {
						archivePath += ArchivePlugin.ARCHIVE_EXTENSION;
					}
					archiveField.setText(archivePath);

					String projectName = ArchivePlugin.getProjectName(archivePath);
					projectNameField.setText(projectName);

					String dir = restoreField.getText().trim();
					if (dir.equals("")) {
						dir = archivePath.substring(0, archivePath.lastIndexOf(File.separator));
						restoreField.setText(dir);
					}
					if ((projectName == null) || (projectName.equals(""))) {
						Msg.showError(this, getComponent(), ArchivePlugin.RESTORE_ERROR_TITLE,
							"Archive File is not a valid project archive.");
					}
				}
			}
		});

		Gui.registerFont(archiveBrowse, Font.BOLD);

		restoreLabel = new GDLabel(" Restore Directory ");
		restoreLabel.getAccessibleContext().setAccessibleName("Restore Directory");
		restoreField = new JTextField();
		restoreField.setName("restoreField");
		restoreField.getAccessibleContext().setAccessibleName("Restore");
		restoreField.setColumns(RestoreDialog.NUM_TEXT_COLUMNS);

		restoreBrowse = new JButton(ArchivePlugin.DOT_DOT_DOT);
		restoreBrowse.setName("restoreButton");
		restoreBrowse.getAccessibleContext().setAccessibleName("Restore Browse");
		restoreBrowse.addActionListener(e -> {
			String dirPath = chooseDirectory("Choose restore directory",
				"Select the directory for restoring the project.");
			if (dirPath != null) {
				restoreField.setText(dirPath);
			}
		});

		Gui.registerFont(restoreBrowse, Font.BOLD);

		projectNameLabel = new GDLabel(" Project Name ");
		projectNameLabel.getAccessibleContext().setAccessibleName("Project Name");
		projectNameField = new JTextField();
		projectNameField.setName("projectNameField");
		projectNameField.getAccessibleContext().setAccessibleName("Project Name");
		projectNameField.setColumns(RestoreDialog.NUM_TEXT_COLUMNS);

		projectNameField.addActionListener(e -> {
			if (archiveField.getText().length() > 0 && restoreField.getText().length() > 0 &&
				projectNameField.getText().length() > 0) {
				okCallback();
			}
		});

		// Actually create the panel and arrange the components in it.

		GridBagLayout gbl = new GridBagLayout();
		JPanel outerPanel = new JPanel(gbl);

		GridBagConstraints gbc = new GridBagConstraints();
		gbc.insets.top = 5;
		gbc.insets.left = 5;
		gbc.insets.right = 5;

		// add the labels
		//
		gbc.anchor = GridBagConstraints.EAST;
		gbc.gridx = 0;
		gbc.gridy = 0;
		gbl.setConstraints(archiveLabel, gbc);
		outerPanel.add(archiveLabel);

		gbc.gridy = 1;
		gbl.setConstraints(restoreLabel, gbc);
		outerPanel.add(restoreLabel);

		gbc.gridy = 2;
		gbl.setConstraints(projectNameLabel, gbc);
		outerPanel.add(projectNameLabel);

		// add the textFields
		//
		gbc.anchor = GridBagConstraints.CENTER;
		gbc.insets.left = 0;
		gbc.insets.right = 0;
		gbc.weightx = 1.0;
		gbc.gridwidth = 1;
		gbc.fill = GridBagConstraints.HORIZONTAL;
		gbc.gridx = 1;
		gbc.gridy = 0;
		gbl.setConstraints(archiveField, gbc);
		outerPanel.add(archiveField);
		gbc.gridy = 1;
		gbl.setConstraints(restoreField, gbc);
		outerPanel.add(restoreField);
		gbc.gridy = 2;
		gbl.setConstraints(projectNameField, gbc);
		outerPanel.add(projectNameField);

		gbc.weightx = 0.0;

		// add the browse buttons
		//
		gbc.anchor = GridBagConstraints.WEST;
		gbc.gridwidth = 1;
		gbc.insets.left = 5;
		gbc.insets.right = 5;
		gbc.gridx = 2;
		gbc.gridy = 0;
		gbl.setConstraints(archiveBrowse, gbc);
		outerPanel.add(archiveBrowse);

		gbc.gridy = 1;
		gbl.setConstraints(restoreBrowse, gbc);
		outerPanel.add(restoreBrowse);
		outerPanel.getAccessibleContext().setAccessibleName("Restore");
		return outerPanel;
	}
Preference name for directory last selected to choose a jar file
to restore.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/archive/RestoreDialog.java