I have this pretty big project that I'm working on, graphic editor, and I've had some big problems working with swing components. However, now I have a programmers worst nightmare, a bug that is happening only some of the times.
If I try to select the elements in my JTree
, whether when adding elements, or when selecting them when they are selected in diagram (JInternalFrame
), some of them don't get expanded.
My structure is something like this, I have a workspace, containing projects and projects that contain diagrams. Diagrams hold all the elements I have, let's say circles, rectangles and so on, in folders (if they are circles, they are put in circles folder...).
Another thing to know is that I select my elements via setSelectedPath/Paths
method of my JTree
.
Some of the things that may help understanding what I do and what I tried:
- I made sure my nodes know how to get to root. (
getTreeModel.getPathToRoot
returns good path) - I tried adding paths to trees selection model and to tree directly
- I have set the trees
expandsSelectedPaths
to true - Nodes are selected when I expand my tree manually (they even expand afterwards), until I add new elements of type that caused problems
- This happens about once when switching through 5 types of elements, and some stranger things happen when I try to add other type of element after I added one that made problems
I hope someone will know what to do, although I think this is very complicated problem. Please ask anything that may help you help me.