This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
I searched through the forum for the answer, I read several comments, but I still don't know what is the proper way to get a JTree resize it's elements. I have a JTree with each node having custom user object. This object can change so the result of it's toString() can also change. I also use a custom TreeCellRenderer which extends DefaultTreeCellRender and sets the node's icon and tooltip text based on the custom user object. The problem occures whenever the new text is wider than the previous one, in this case the items in the tree will be cropped, since no resize happens on them.
Can anybody explain me the proper(or at least a good) way of doing this.
Thanks in advance,
Thanks Rob. In my case every custom user object change its state individually on some kind of event. Is this mean that I have to store a reference to the JTree(or at least to the data model) and to the TreeNode which contains my data in order to call treeNodesChangedEvent?
P.S.: I tried it with storing the references, and it's workig, but it has a side effect, it closes the childnode group. Can I prevent it somehow?