public void attachToScrollPane(JScrollPane scrollPane) {
    scrollPane.getViewport().addChangeListener(new ChangeListener() {
      @Override
      public void stateChanged(ChangeEvent e) {
        repaint();
      }
    });
  }
public void attachToScrollPane(JScrollPane scrollPane)