I'd like to know if the divider line was moved by the user. Installing a
PropertyChangeListener on JSplitPane.DIVIDER_LOCATION_PROPERTY does not
solve the problem because this event is also fired when the user resizes the
container so that the divider would be outside the container. In this case
the divider is automatically moved to fullfil the minimum size and
"dividerLocation" PropertyChange event gets fired.
Is there any chance to catch something like a divider drag end event?
Andreas
If the used l&f uses a SplitPaneUI extending from BasicSplitPaneUI, you
could add a MouseMotionListener to the divider you can get from the
BasicSplitPaneUI:
SplitPaneUI ui = split.getUI();
if (ui instanceof BasicSplitPaneUI) {
BasicSplitPaneUI basicUI = (BasicSplitPaneUI) ui;
basicUI.getDivider().addMouseMotionListener(new
MouseMotionListener() {
public void mouseDragged(MouseEvent e) {
System.out.println("DividerTest.mouseDragged");
}
public void mouseMoved(MouseEvent e) {
}
});
}
You can work from there on.
If not, you'll have to check on working directly on that UI and else
you're out of luck
Regards,
Bart
Andreas Thiele - 09 Mar 2006 10:36 GMT
> If the used l&f uses a SplitPaneUI extending from BasicSplitPaneUI, you
> could add a MouseMotionListener to the divider you can get from the
> BasicSplitPaneUI:
> ...
Exactly what I need. I already was searching in this direction but didn't
notice basicUI.getDivider().
Thanks, a great help.
Andreas