/** 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())); }
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)); }
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); }
public void adjustmentValueChanged(AdjustmentEvent e) { offset = scrollBar.getValue(); table.tableChanged(cEvent); }
public void clear() { table.setModel(model); offset = 0; scrollBar.setValue(0); scrollBar.setMaximum(0); }