title: JTree How To Change A Node programmatically?
body: <p>I'm trying for the first time to use and understand JTrees, TreeModels, TreeModes etc. I want to use a Tree to represent Bluetooth devices in the vicinity of my local device. My Bluetooth device is the Root node of the tree and any FIRST descendents from the root node will be Bluetooth devices in the vicinity.</p>
  
  <p>I set up my Tree to begin with as follows (code shortened for brevity):</p>
  
  <pre><code>topTreeNode = new DefaultMutableTreeNode("Local Bluetooth Device");
  treeModel = new DefaultTreeModel(topTreeNode);
  jTree1 = new javax.swing.JTree(treeModel);
  </code></pre>
  
  <p>When the JTree is initially displayed the root node reads 'Local Bluetooth Device'. However once I initialise the Bluetooth stack I'd like the root node to display the 'friendly name' and address of my Local bluetooth device.</p>
  
  <p>The problem I have got is just how do I change the root node? I have tried a variety of methods including creating a new DefaultMutableTreeNode() for topTreeNode but the JTree doesn't re-draw straight away. Am I supposed to implement a listener?</p>