docs: private void checkScrollBar(AdjustmentEvent e) {
          //  The scroll bar listModel contains information needed to determine
          //  whether the viewport should be repositioned or not.
          JScrollBar jsb = (JScrollBar) e.getSource();
          BoundedRangeModel listModel = jsb.getModel();
          int value = listModel.getValue();
          int extent = listModel.getExtent();
          int maximum = listModel.getMaximum();
          boolean valueChanged = previousValue != value;
          boolean maximumChanged = previousMaximum != maximum;
          //  Check if the user has manually repositioned the scrollbar
          if (valueChanged && !maximumChanged) {
              if (viewportPosition == START) {
                  adjustScrollBar = value != 0;
              } else {
                  adjustScrollBar = value + extent >= maximum;
              }
          }
          //  Reset the "value" so we can reposition the viewport and
          //  distinguish between a user scroll and a program scroll.
          //  (ie. valueChanged will be false on a program scroll)
          if (adjustScrollBar && viewportPosition == END) {
              //  Scroll the viewport to the end.
              jsb.removeAdjustmentListener(this);
              value = maximum - extent;
              jsb.setValue(value);
              jsb.addAdjustmentListener(this);
          }
          if (adjustScrollBar && viewportPosition == START) {
              //  Keep the viewport at the same relative viewportPosition
              jsb.removeAdjustmentListener(this);
              value = value + maximum - previousMaximum;
              jsb.setValue(value);
              jsb.addAdjustmentListener(this);
          }
          previousValue = value;
          previousMaximum = maximum;
      }