splitPane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(java.beans.PropertyChangeEvent evt) { if (evt.getPropertyName().equals(JSplitPane.DIVIDER_LOCATION_PROPERTY)) { //action code JSplitPane tsplitPane= (JSplitPane) evt.getSource(); double changewidth = tsplitPane.getDividerLocation();//srrollPane.getViewport().getWidth(); } } } });