void (Consumer<? super T> callback) { myBuilder.setItemChosenCallback(() -> { TreePath path = myTree.getSelectionModel().getLeadSelectionPath(); T component = (T)path.getLastPathComponent(); if (component != null) { callback.consume(component); } }); }