void (MyNode nodeToAdd, MyNode parent) { int i = TreeUtil.indexedBinarySearch(parent, nodeToAdd, getNodeComparator()); int insertionPoint = i >= 0 ? i : -i - 1; ((DefaultTreeModel)myTree.getModel()).insertNodeInto(nodeToAdd, parent, insertionPoint); }