/** Returns the coordinates of the top left corner of the value at the given index. */
 public Point getCoordinates(int index) {
   JScrollBar bar = scrollPane.getVerticalScrollBar();
   Rectangle r = pinsTable.getCellRect(index, 2, true);
   pinsTable.scrollRectToVisible(r);
   return new Point(
       (int) (r.getX() + topLevelLocation.getX()),
       (int) (r.getY() + topLevelLocation.getY() - bar.getValue()));
 }
예제 #2
0
  public void setResultSet(DiskResultSet rset) throws Exception {
    set = rset;

    max = rset.getRowCount();

    table.setModel(model);
    table.setModel(this);

    offset = 0;
    scrollBar.setValue(0);
    scrollBar.setMaximum((max < window ? 0 : max - window));
  }
예제 #3
0
  private void addControls() {
    setLayout(new BorderLayout());

    scrollBar = new JScrollBar(JScrollBar.VERTICAL);

    table = new JTable(this);
    add(
        new JScrollPane(
            table,
            JScrollPane.VERTICAL_SCROLLBAR_NEVER,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED));
    add(scrollBar, BorderLayout.EAST);

    scrollBar.addAdjustmentListener(this);
    scrollBar.setMinimum(0);
  }
예제 #4
0
 public void adjustmentValueChanged(AdjustmentEvent e) {
   offset = scrollBar.getValue();
   table.tableChanged(cEvent);
 }
예제 #5
0
 public void clear() {
   table.setModel(model);
   offset = 0;
   scrollBar.setValue(0);
   scrollBar.setMaximum(0);
 }