Copyright Derek O'Reilly, Dundalk Institute of Technology (DkIT), Dundalk, Co. Louth, Ireland.
DragAnd Drop (DnD) is available for many Components.
DragAndDrop Example: (Run Applet)
import javax.swing.*; public class DragAndDropDemo extends JApplet { @Override public void init() { this.setContentPane(new View()); } public class View extends JPanel { private final JTextArea textArea = new JTextArea("Welcome to DkIT"); private final JTextField textField = new JTextField(20); public View() { super(); add(this.textArea); // add the scrollable area add(this.textField); this.textArea.setDragEnabled(true); this.textField.setDragEnabled(true); } } }
Copyright Derek O' Reilly, Dundalk Institute of Technology (DkIT), Dundalk, Co. Louth, Ireland.