Hi, I'm fairly new with JTrees and in fact, Java on the whole. I've created a JTree with JCheckBoxes as the nodes. How do you implement listeners on such a component? For eg, can I use an ItemEvent listener for the checkboxes, while using a TreeSelectionListener for the nodes? I want to be able to get the data at the node that was checked, which my tre does right now, but also when the box is deselected, I want to perform some action. Can this be done with an ItemListener on the checkbox?? Please, any assistance is appreciated. It's urgent!
I hope I'm wrong, but I think if you set the JComboBox as the Renderer for JTree nodes that's all it is, it tells it how to render. JTree has a different model for Rendering and Selection. But I'm probably wrong about this
I stand corrected (ran a little test that flopped). I have not had much practical experience with JTrees other than using them as a navigation aid with Strings at the nodes. Unfortunately JTree is not as robust as JTable but I am sure you can accomplish your task if you stay with it. I just fear it may get pretty involved. I will definitely investigate this further because we're all here to learn.
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Hey...thanks guys! I will try the mouseListener and let you know if it works. Do any of you know about a getOldLeadSelectionPath() method?? I read this in another post...it was an option for determining the deselected node. I will keep you posted. Thanks again!!