Ejemplo n.º 1
0
  public CurrentPageChanger(
      JScrollPane scrollpane,
      AbstractDocumentView documentView,
      List<AbstractPageViewComponent> pageComponents,
      boolean addWheelMouseListener) {

    this.pageComponents = pageComponents;
    this.scrollpane = scrollpane;
    this.documentView = documentView;
    documentViewModel = documentView.getViewModel();

    // listen for scroll bar manaipulators
    this.documentView.addMouseListener(this);
    this.scrollpane.getHorizontalScrollBar().addAdjustmentListener(this);
    this.scrollpane.getHorizontalScrollBar().addMouseListener(this);

    this.scrollpane.getVerticalScrollBar().addAdjustmentListener(this);
    this.scrollpane.getVerticalScrollBar().addMouseListener(this);

    //        addMouseListenerToAnyButtonsIn(scrollpane.getHorizontalScrollBar());
    //        addMouseListenerToAnyButtonsIn(scrollpane.getVerticalScrollBar());

    // load wheel mouse listener
    mouseWheelCurrentPageListener = MouseWheelCurrentPageListener.install(scrollpane, this);
  }
Ejemplo n.º 2
0
  public void dispose() {
    // remove standard mouse listeners
    documentView.removeMouseListener(this);
    scrollpane.getHorizontalScrollBar().removeAdjustmentListener(this);
    scrollpane.getHorizontalScrollBar().removeMouseListener(this);
    scrollpane.getVerticalScrollBar().removeAdjustmentListener(this);
    scrollpane.getVerticalScrollBar().removeMouseListener(this);

    // Remove wheel mouse listener
    MouseWheelCurrentPageListener.uninstall(scrollpane, mouseWheelCurrentPageListener);
  }