Using an addLayoutClickListener to detect clicks to tree nodes

I’m using a tree as a vertical menu for adding and removing components to the window based on the user’s clicks. I have been using the method getClass() to return the component that the user is clicking over, but it returns the entire tree component. How might I return more specifically the nodes of the tree that are being clicked? Thank you.