JComponent () { myTextArea = new JTextArea(10, 50); myTextArea.setText(getText()); myTextArea.setWrapStyleWord(true); myTextArea.setLineWrap(true); myTextArea.getDocument().addDocumentListener(new DocumentAdapter() { @Override public void textChanged(@NotNull DocumentEvent event) { if (myChangeListener != null) { myChangeListener.run(); } } }); DumbAwareAction.create(e -> doOKAction()).registerCustomShortcutSet(CommonShortcuts.ENTER, myTextArea); return ScrollPaneFactory.createScrollPane(myTextArea); }