void (PropertyChangeEvent evt) { String propertyName = evt.getPropertyName(); if ("horizontalScrollBar".equals(propertyName) || "verticalScrollBar".equals(propertyName)) { removeScrollBarListener(ObjectUtils.tryCast(evt.getOldValue(), JScrollBar.class)); addScrollBarListener(ObjectUtils.tryCast(evt.getNewValue(), JScrollBar.class)); } }