[quote]Go on Adam, spill the beans. What’s got your goat about the JTree?
Cas 
[/quote]
I smell troll in the air, but…
In short, the API is a dog’s dinner. Since it doesn’t even integrate nicely with the other Swing components (JTable, JList, etc) the only good thing most people can say about it is that it works (but c.f. below).
My particular problems include:
[list]
[] TreePath should not exist, it should be an interface if it has to.
[] TP has the appearance of a 1st year compsci student writing “my first tree data structure”. It’s crap.
[] JT has major multiple-personality disorder: some methods are TP-only, others are “visible row out of those on the screen” only, others are both.
[] Visible row on screen is ill-defined, and incompletely accessible (from trial and error it appears it’s particularly difficult to work in visible-rows because you don’t know what’s first, you don’t know the set of indices that are currently visible, etc - the methods for ascertaining this simply don’t exist)
[] There are approx 125 new methods in Jtree; that’s about 4 times as many as are absolutely necessary IMHO - it also suggests that the API is likely to be evil to try and use (which it is :))
[] TreeNode. Well, rather like TP it’s a stupid class (with simlar problems) and it CERTAINLY should not be in the JTree class - this is the kind of thing that should only ever be in a subclass or similar.
[] TreeModel is a crap i/f to model trees; again, it appears to have been designed by someone so thoroughly inexperienced with GUI dev that they had no idea what the appropriate methods were for such a major interface. At least they made it an interface, so I should be grateful, I guess.
[] TM allows null roots, even though JT falls into a wet heap with all sorts of subtly weird behaviour whenever you do this
[] JT’s friends have a pathological desire to collapse nodes whenever possible; to correct this, you have to subclass loads of methods (the collapsing is spread around quite liberally).
[] It’s just massively unwieldy and gives people a serious headache trying to work with it. There’s plenty more to complain about other dependent classes (like the TreeModelEvent’s etc), but I’ll stick with just covering the tightly integrated ones.
OTOH, it does work - albeit almost never the way you want it too, and with considerable pain on the dev’s behalf.
It’s also got some decent performance enhancing stuff inside.
PS FYI it seems the standard price to license 3rd party Jtree impls is $200-400 !!! (single license, single dev, single product; site licenses and multi-product are more). It seems we’re all in the wrong business…