예제 #1
0
  @Override
  public void addNotify() {
    super.addNotify();

    Component c = getParent();

    //  Keep scrolling of the row table in sync with the main table.

    if (c instanceof JViewport) {
      JViewport viewport = (JViewport) c;
      viewport.addChangeListener(this);
    }
  }
 public void viewportSet(JViewport viewport) {
   viewport.addChangeListener(
       new ChangeListener() {
         @Override
         public void stateChanged(ChangeEvent e) {
           TableModel model = getModel();
           if (model instanceof AbstractTableModel) {
             Couple<Integer> visibleRows = ScrollingUtil.getVisibleRows(VcsLogGraphTable.this);
             ((AbstractTableModel) model)
                 .fireTableChanged(
                     new TableModelEvent(
                         model,
                         visibleRows.first - 1,
                         visibleRows.second,
                         GraphTableModel.ROOT_COLUMN));
           }
         }
       });
 }