If I wanted my Node to have a name, I'd extend the base class, here DefaultMutableTreeNode, and give it a String name field, and then fill that field with a value via a constructor, one that takes both a String name parameter and a String text parameter. And then also give it a getter method.
I wouldn't try to get its "variable" name since that is close to Meaningless. Many variables don't even have "names", that an object can be referenced by 2, 3, 100, ... variables.
Edit
You state in an edit:
To make this more clear: I have a JFrame, with a JPanel, a JScrollPane, a JTree, and some text fields. Depending on which node is clicked (node 1, or node 2), I want to show or hide certain text fields.
Again, variable names are close to meaningless and almost don't exist in compiled code. What counts are variable references -- being able to grab a variable, and object state -- the state of the fields held by that variable.