List of usage examples for javax.swing JTable getAutoscrolls
public boolean getAutoscrolls()
autoscrolls
property. From source file:org.nuclos.client.ui.collect.result.ResultController.java
private ListSelectionListener newListSelectionListener(final JTable tblResult) { return new ListSelectionListener() { @Override//w ww.j a va 2 s . c om public void valueChanged(ListSelectionEvent ev) { try { final ListSelectionModel lsm = (ListSelectionModel) ev.getSource(); final CollectStateModel<?> clctstatemodel = clctctl.getCollectStateModel(); if (clctstatemodel.getOuterState() == CollectState.OUTERSTATE_RESULT) { final int iResultMode = CollectStateModel.getResultModeFromSelectionModel(lsm); if (iResultMode != clctctl.getCollectStateModel().getResultMode()) { clctctl.setCollectState(CollectState.OUTERSTATE_RESULT, iResultMode); } } if (!ev.getValueIsAdjusting()) { // Autoscroll selection. It's okay to do that here rather than in the CollectStateListener. if (!lsm.isSelectionEmpty() && tblResult.getAutoscrolls()) { // ensure that the last selected row is visible: final int iRowIndex = lsm.getLeadSelectionIndex(); final int iColIndex = tblResult.getSelectedColumn(); final Rectangle rectCell = tblResult.getCellRect(iRowIndex, iColIndex != -1 ? iColIndex : 0, true); if (rectCell != null) { tblResult.scrollRectToVisible(rectCell); } } } } catch (CommonBusinessException ex) { Errors.getInstance().showExceptionDialog(clctctl.getTab(), ex); } } // valueChanged }; }