title: Storing and using multiple values per JTree node
body: <p>Okay, I'm very new to Java so please bear with me.</p>
  
  <p>I am using Netbeans 6.8 to write a small desktop application that includes a <code>JTree</code> component, and my requirement is that I be able to save and load the tree structure, but that the structure allows for three items of information per tree node - The text to be displayed as the node, a unique identifier, and a file name.</p>
  
  <p>Of course I would also need to be able to get all three bits of information when a node is clicked.</p>
  
  <p>I have successfully saved the and loaded the tree model using <code>getModel()</code> and <code>XMLDecoder</code>/<code>encoder</code>, but this of course only saves the default tree model.</p>
  
  <p>I have followed several tutorials on creating a custom tree model but I have found them confusing, and I have been unable to transfer what they were telling me into my own project, since of course they usually create an entire example application in one go.</p>
  
  <p>Assuming that a tree model like this is even possible please could someone explain how to go about creating such a model, and most importantly, how to place the model into a <code>JTree</code> that already exists in the application (and how I would go about retrieving the information when a node is clicked - I can currently find the selected node and retrieve its text)</p>
  
  <p>If this is not possible Id gladly hear any alternative methods that result in the same functionality.</p>
  
  <p><strong>A solution</strong> has been reached so thanks to everyone for their efforts, however the correct answer must go to Andrew for posting it first!</p>
  
  <p>For those interested:
  I used the Netbeans IDE to create a new <code>Javabean</code> object. Once I realised the difference between this and a normal object I managed to place a newly created <code>Javabean</code> object into a tree node. Just to make it all good, my original method of saving still works fine!</p>
  
  <p>thanks for your efforts everyone.</p>
  
  <p>MVK</p>