Dovrei usare il seguente codice ma non riesco a capire il funzionamento e l'utilità del Position.Bias.Forward.codice:// Find node to which new node is to be added int startRow = 0; String prefix = "J"; TreePath path = tree.getNextMatch(prefix, startRow, Position.Bias.Forward); /****** HELP ******/ MutableTreeNode node = (MutableTreeNode)path.getLastPathComponent(); // Create new node MutableTreeNode newNode = new DefaultMutableTreeNode("green"); // Insert new node as last child of node model.insertNodeInto(newNode, node, node.getChildCount());
Come se non bastasse il compilatore mi segnala un'errore, dicendomi che il package Position non esiste.
Io però l'ho incluso con la direttivaQualcuno può aiutarmi?codice:import javax.swing.text.Position.Bias;
Grazie