Google Tag Manager

2017/07/31

Detects that it has reached the bottom of JScrollPane

Code

JScrollPane scroll = new JScrollPane(c);
scroll.getVerticalScrollBar().getModel().addChangeListener(e -> {
  BoundedRangeModel m = (BoundedRangeModel) e.getSource();
  int extent  = m.getExtent();
  int maximum = m.getMaximum();
  int value   = m.getValue();
  if (value + extent >= maximum) {
    check.setEnabled(true);
  }
});

References