In this section, we’ll show you how to implement a drop target. Our example is again a
JList with image icons. We’ll add drop support so that users can drop images into the list.
To make a component into a drop target, set a
TransferHandler and implement the
You can add a transfer handler to a
JFrame. This is most commonly used for dropping files into an application. Valid drop locations include the frame decorations and the menu bar, but not components contained in the frame (which have their own transfer handlers).
canImport method is called continuously as the user moves the ...