super("Rearrangeable Tree");
setSize(300,200);
setDefaultCloseOperation(EXIT_ON_CLOSE);
// If you want autoscrolling, use this line:
tree = new AutoScrollingJTree();
// Otherwise, use this line:
//tree = new JTree();
getContentPane().add(new JScrollPane(tree), BorderLayout.CENTER);
// If we only support move operations...
//ds = new TreeDragSource(tree, DnDConstants.ACTION_MOVE);
ds = new TreeDragSource(tree, DnDConstants.ACTION_COPY_OR_MOVE);
dt = new TreeDropTarget(tree);
setVisible(true);