void (@NotNull JComponent wrappee) { Runnable leaveCallback = () -> { if (!isOverComponent(myTree) && !isOverComponent(myLabel)) hideDropArea(); }; DnDSupport .createBuilder(myDropArea) .enableAsNativeTarget() .setCleanUpOnLeaveCallback(leaveCallback) .setDropEndedCallback(() -> hideDropArea()) .setTargetChecker(this) .setDropHandler(this) .setDisposableParent(AttachableProjectViewPane.this) .install(); hideDropArea(); removeAll(); add(myDropArea, BorderLayout.SOUTH); add(wrappee, BorderLayout.CENTER); }