729 JScrollBar sb = (JScrollBar)pce.getOldValue(); 730 if (sb != null) { 731 if (cl != null) { 732 sb.getModel().removeChangeListener(cl); 733 } 734 if (pcl != null) { 735 sb.removePropertyChangeListener(pcl); 736 } 737 } 738 sb = (JScrollBar)pce.getNewValue(); 739 if (sb != null) { 740 if (cl != null) { 741 sb.getModel().addChangeListener(cl); 742 } 743 if (pcl != null) { 744 sb.addPropertyChangeListener(pcl); 745 } 746 } 747 } 748 749 public class PropertyChangeHandler implements PropertyChangeListener 750 { 751 752 // NOTE: This class exists only for backward compatibility. All 753 // its functionality has been moved into Handler. If you need to add 754 // new functionality add it to the Handler, but make sure this 755 // class calls into the Handler. 756 757 public void propertyChange(PropertyChangeEvent e) 758 { 759 getHandler().propertyChange(e); 760 } 761 } 762 763 764 765 /** 766 * Creates an instance of {@code PropertyChangeListener} that's added to 767 * the {@code JScrollPane} by {@code installUI()}. Subclasses can override 768 * this method to return a custom {@code PropertyChangeListener}, e.g. 769 * <pre> 770 * class MyScrollPaneUI extends BasicScrollPaneUI { 771 * protected PropertyChangeListener <b>createPropertyChangeListener</b>() { 772 * return new MyPropertyChangeListener(); 773 * } 774 * public class MyPropertyChangeListener extends PropertyChangeListener { 775 * public void propertyChange(PropertyChangeEvent e) { 776 * if (e.getPropertyName().equals("viewport")) { | 729 JScrollBar sb = (JScrollBar)pce.getOldValue(); 730 if (sb != null) { 731 if (cl != null) { 732 sb.getModel().removeChangeListener(cl); 733 } 734 if (pcl != null) { 735 sb.removePropertyChangeListener(pcl); 736 } 737 } 738 sb = (JScrollBar)pce.getNewValue(); 739 if (sb != null) { 740 if (cl != null) { 741 sb.getModel().addChangeListener(cl); 742 } 743 if (pcl != null) { 744 sb.addPropertyChangeListener(pcl); 745 } 746 } 747 } 748 749 /** 750 * Property change handler. 751 */ 752 public class PropertyChangeHandler implements PropertyChangeListener 753 { 754 755 // NOTE: This class exists only for backward compatibility. All 756 // its functionality has been moved into Handler. If you need to add 757 // new functionality add it to the Handler, but make sure this 758 // class calls into the Handler. 759 760 /** 761 * {@inheritDoc} 762 */ 763 public void propertyChange(PropertyChangeEvent e) 764 { 765 getHandler().propertyChange(e); 766 } 767 } 768 769 770 771 /** 772 * Creates an instance of {@code PropertyChangeListener} that's added to 773 * the {@code JScrollPane} by {@code installUI()}. Subclasses can override 774 * this method to return a custom {@code PropertyChangeListener}, e.g. 775 * <pre> 776 * class MyScrollPaneUI extends BasicScrollPaneUI { 777 * protected PropertyChangeListener <b>createPropertyChangeListener</b>() { 778 * return new MyPropertyChangeListener(); 779 * } 780 * public class MyPropertyChangeListener extends PropertyChangeListener { 781 * public void propertyChange(PropertyChangeEvent e) { 782 * if (e.getPropertyName().equals("viewport")) { |