Catch Events After JSplitPane Divider Location Is Moved


Catching events after you move a JSplitPane‘s divider can be made possible through the PropertyChangeListenerJSplitPane class. Make sure you supply the ‘s DIVIDER_LOCATION_PROPERTY as the parameter so that this listener will listent to modified divider location events.

If you do not supply this as the first parameter in the addPropertyChangeListener() method, you can always place a conditional statement if the PropertyChangeEvent‘s getPropertyName() method returns dividerLocation as the value.

1
2
3
4
5
6
jSplitPane1.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, new PropertyChangeListener() {
	@Override
	public void propertyChange(PropertyChangeEvent pce) {
		// do here
	}
});

Found this post useful? Buy me a cup of coffee or help support the sponsors on the right.

Related Posts with Thumbnails

Leave a Reply

Spam protection by WP Captcha-Free