return b.toString();
}
@Override
protected void importString(JTree target, String s) {
DefaultTreeModel model = (DefaultTreeModel) target.getModel();
int index = target.getRowForPath(target.getSelectionPath());
// Prevent the user from dropping data back on itself.
if (rows != null && index >= rows[0] - 1 && index <= rows[rows.length - 1]) {
rows = null;
return;
}
int max = target.getRowCount();
if (index < 0) {
index = max;
} else if (index > max) {
index = max;
}
addIndex = index;
String[] values = s.split("\n");
addCount = values.length;
for (String value : values) {
TreePath path = target.getPathForRow(index++);
model.insertNodeInto(new DefaultMutableTreeNode(value), (MutableTreeNode) path.getLastPathComponent(), 0);
}
}