Hi.
I have a JSplitPane in my GUI. Both the left and the right components of this split pane are JScrollPane's.
The left scroll pane contains a JTree with several items.
The problem I am having is, that when the user moves the divider location of the split pane, and then selects an item from the JTree on the left, the divider location jumps back into its initial value.
Annoyed by this behavior I tried to hack it for now with the following code:
But this hack does not work either. Sometimes it works, but other times when I select an Item the divider location jumps back to the initial value again.splitPane.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { scrollPane.setPreferredSize(new Dimension(splitPane.getDividerLocation() - 1, MIN_HEIGHT)); } });
I am probably overlooking some obvious setting here, but for the love of god I can not find the problem at the moment.
Thank you all very much.