@Override
			public void keyPressed(KeyEvent e) {
				// Note: we override the [ENTER] key handling to allow the user to invoke the
				// dialog and just hit enter to create the string without having to do any
				// clicking (otherwise the charset combobox consumes the keystroke)
				if (e.getKeyChar() == '\n') {
					e.consume();
					if (charsetComboBox.isPopupVisible()) {
						charsetComboBox.setPopupVisible(false);
					}
					else {
						EncodedStringsDialog.this.createButton.doClick();
					}
				}
			}
For test/screen shot use

@return button
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/strings/EncodedStringsDialog.java