If you've ever seen the Finder in the Mac UI, that's an example of the approach I want to use. My component accepts a TreeModel, and displays all children of the root in the leftmost JList. When the user selects an item in the list, a JList is added to the right of the first, containing the selection's children, and so on.
The implementation starts with a single JSplitPane with the first-order-children in a JList as its left component. The first selection creates a new JSplitPane with the appropriate second-order-children in a JList as its left component, and makes that new split pane the right component of the first one, and so on.
I've implemented this special purpose split pane as a subclass of JSplitPane. (SplitTreeSplitPane, STSP for short). So a STSP always has a JList in a scroll pane as its left component, and either a very thin spacer panel or another (nested) STSP as its right component. STSP implements ListSelectionListener, Scrollable, and PropertyChangeListener.
The dynamic addition and removal of nested STSP's works well; I'm making the whole thing resize appropriately and scroll to make the newly added list visible at the right times. The problems begin when the user moves any divider - I can't seem to make it resize when the dividers are dragged. Moving a divider just a little (less than the width of that rightmost spacer) works fine; the space gained in the JList to the left of the divider is lost by the spacer. Move it any more and the JLists to the right start shrinking. Move it so much that all the JLists to the right are down to minimum size, and you can't move it any more.
I'm listening to property change events for the divider location property, calculating the amount moved, and resizing up the chain. Or rather, attempting to - all attempts to set the size in the property change handler are in vain. The timing of the property change event seems to be the stumbling block. The logic that works with list selection events doesn't work there.
I really want to stick with JSplitPane and not roll my own out of JPanels, so I can get the one-touch behavior, good LAF support, etc.
Ideas?
Jerry