Java Code Examples for javax.swing.tree.MutableTreeNode#insert()

The following examples show how to use javax.swing.tree.MutableTreeNode#insert() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WebTreeModel.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void insertNodeInto ( @NotNull final MutableTreeNode child, @NotNull final MutableTreeNode parent, final int index )
{
    // Inserting node
    parent.insert ( child, index );

    // Firing node addition
    nodesWereInserted ( parent, new int[]{ index } );
}
 
Example 2
Source File: SwingExtensions.java    From groovy with Apache License 2.0 2 votes vote down vote up
/**
 * Overloads the left shift operator to provide an easy way to add
 * nodes to a MutableTreeNode.<p>
 *
 * @param self a MutableTreeNode
 * @param node a node to be added to the treeNode.
 * @return same treeNode, after the value was added to it.
 * @since 1.6.4
 */
public static MutableTreeNode leftShift(MutableTreeNode self, MutableTreeNode node) {
    self.insert(node, self.getChildCount());
    return self;
}
 
Example 3
Source File: SwingExtensions.java    From groovy with Apache License 2.0 2 votes vote down vote up
/**
 * Allow MutableTreeNode to work with subscript operators.<p>
 * <b>WARNING:</b> this operation does not replace the node at the
 * specified index, rather it inserts the node at that index, thus
 * increasing the size of the treeNode by 1.<p>
 *
 * @param self  a MutableTreeNode
 * @param index an index
 * @param node  the node to insert at the given index
 * @since 1.6.4
 */
public static void putAt(MutableTreeNode self, int index, MutableTreeNode node) {
    self.insert(node, index);
}