• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Drag and Drop

In the latest version of the SDK, all drag-and-drop (DnD) operations (for both Swing and AWT components) are supported through the interface java.awt.dnd. Listing 37.14 shows a typical DnD program.

Note

When a class implements an interface, the class must provide an implementation of every method in the interface. To implement a drag-and-drop target, a class must implement DropTargetListener. As shown in Listing 37.14, most of the work is done in dragEnter() and drop().



PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint