README file for DND3 Demo directory. The demos in this directory illustrate a few different GUI techniques in Java. These demos are for class use only. To illustrate step-by-step design, and also to allow you to see which lines of code are essential for which types of functionality, I have broken the demo up into several versions. These are the actual intermediate versions of the demo as I wrote it. The most recent code is in the main directory. At present, this is not working code. For a working version, go to one of the numbered subdirectories. v1.0: Brings up a window with 2 nested buttons. The large button has been given the appearance of a desktop, and the small button the appearance of a file folder. Each of these buttons is defined in its own file, as a subclass of JButton. The class NewDemo initializes a frame containing one of each button. The IconButton has been made Draggable. If you drag and drop the IconButton onto Microsoft Word, for example, it will insert the text "Reposition me", which is the transferable data associated with the IconButton. In this version, there is no DropTarget within NewDemo. The Desktop is a subclass of button with an eye to implementing drag and drop in later versions. Only selectable components can be drop targets. Although you can click on the Desktop, I have modified the button appearance so that it will not highlight when clicked. v1.1: Now the Desktop is a drop target. If you drag the folder icon and drop it on the desktop, the folder will be repositioned. However, this is a bad implementation, for the following reasons: (1) What is worst is that, when the drop target receives a "Reposition me" drop, it repositions the child component at index 0. It doesn't matter whether you drag the string "Reposition me" from Microsoft Word (try it!) or from a different IconButton (although there are none right now). Actually, I take that back about Microsoft Word. Drags from outside the application don't seem to support StringFlavor, so these drops are rejected. (2) Also, the drag source (IconButton) is not providing an adequate Transferable. It needs to supply all the necessary information for the drop target to make the reposition happen. v1.2: (not completed) Major changes in this version. (1) The drag source (IconButton) now implements Transferable. This means that instead of passing a string as transferable, it just passes itself. After a drop, the receiving component can request content data directly from the IconButton (i.e. the received Transferable). 3 DataFlavors are supported. 2 are plain text, and the associated content is the string "Reposition me" as before. The third returns the IconButton itself, by reference. If the drop target actually wishes to reposition the button, it will use Transferable.getContent(theIconFlavor) to get hold of the button. (2) The drop target (DesktopButton) is now a much more sophisticated drop listener. It requests the list of available flavors, and prints them out to the debugging stream (stdout). If any of the flavors are text-only, it looks at and prints out the first line of text content. This now works correctly with DND from Microsoft Word under Windows. If the text says "Reposition me", and there is a DataFlavor corresponding to an IconButton, the icon is identified from the Transferable.getContent method, and is relocated to the drop location.