void (@NotNull JComponent component) { if (component instanceof Autoscroll) return; // Swing DnD component.putClientProperty(ENABLED, true); component.setAutoscrolls(false); // disable default scroller if needed DropTarget target = component.getDropTarget(); if (target == null && !GraphicsEnvironment.isHeadless()) { component.setDropTarget(new DropTarget(component, DragListener.ACTION, DragListener.SHARED)); } }