Creating an Example Program
It's time to take what you've learned and create an example program (see Listing 12.7). This program simply places two controls in a Java application, and then allows the text from one control to be dragged to another.
There are two classes that do the majority of the work. They're named DropLabel (see Listing 12.6) and DragField (see Listing 12.5). The DropLabel class extends a JLabel class and is the target to which the drop operation aims. The DragField class extends a JTextField class and is the source for the drag operation. When the program runs, you'll see that the editable text field says "Drag Me!" and the label says "Drop On Me" (see Figure 12.1). Listing 12.5 shows the source code for the DragField class. ...
Get JavaBeans Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.