if (old != null) { BoundedRangeModel model = old.getModel(); if (model != null) model.removeChangeListener(scrollListener); } if (h != null) { BoundedRangeModel model = h.getModel(); if (model != null) model.addChangeListener(scrollListener); }
  public void setHorizontalScrollBar(JScrollBar h)  {    if (horizontalScrollBar == h)      return;    JScrollBar old = horizontalScrollBar;    removeNonNull(old);    horizontalScrollBar = h;    addNonNull(h, JScrollPane.HORIZONTAL_SCROLLBAR);    firePropertyChange("horizontalScrollBar", old, h);    sync();    if (old != null)      {        BoundedRangeModel model = old.getModel();        if (model != null)          model.removeChangeListener(scrollListener);      }    if (h != null)      {        BoundedRangeModel model = h.getModel();        if (model != null)          model.addChangeListener(scrollListener);      }  }