void (Runnable callback) { DocumentAdapter adapter = new DocumentAdapter() { @Override protected void textChanged(@NotNull DocumentEvent e) { callback.run(); } }; myTfName.getDocument().addDocumentListener(adapter); myTfPath.getDocument().addDocumentListener(adapter); }