tree.scrollRowToVisible(row);
@Override public void actionPerformed( ActionEvent e ) { int[] selectionRows = _tree.getSelectionRows(); if( selectionRows != null ) { int selectionRow = selectionRows[0]; selectionRow = Math.max( 0, selectionRow - 10 ); _tree.setSelectionRow( selectionRow ); _tree.scrollRowToVisible( selectionRow ); } } } );
@Override public void actionPerformed( ActionEvent e ) { int[] selectionRows = _tree.getSelectionRows(); if( selectionRows != null ) { int selectionRow = selectionRows[0]; selectionRow = Math.max( 0, selectionRow - 10 ); _tree.setSelectionRow( selectionRow ); _tree.scrollRowToVisible( selectionRow ); } } } );
@Override public void actionPerformed( ActionEvent e ) { int[] selectionRows = _tree.getSelectionRows(); if( selectionRows != null ) { int selectionRow = selectionRows[0]; selectionRow = Math.min( _tree.getRowCount() - 1, selectionRow + 10 ); _tree.setSelectionRow( selectionRow ); _tree.scrollRowToVisible( selectionRow ); } } } );
@Override public void actionPerformed( ActionEvent e ) { int[] selectionRows = _tree.getSelectionRows(); if( selectionRows != null ) { int selectionRow = selectionRows[0]; selectionRow = Math.min( _tree.getRowCount() - 1, selectionRow + 10 ); _tree.setSelectionRow( selectionRow ); _tree.scrollRowToVisible( selectionRow ); } } } );
@Override public void run() { ignoreTreeSelectionEvents = true; treeTable.getTree().getSelectionModel().setSelectionPaths(paths.toArray(new TreePath[paths.size()])); ignoreTreeSelectionEvents = false; int maxRow = 0; for (final TreePath tp : paths) { final int row = treeTable.getTree().getRowForPath(tp); maxRow = Math.max(maxRow, row); } final int row = maxRow; treeTable.getTree().scrollRowToVisible(row); treeTable.repaint(); } });
private void selectMatchingRow() { myFilterTextField.setForeground(UIManager.getColor("TextField.foreground")); myJavaHierarchyTree.setSelectionRow(-1); // select first matching for (int row = 0; row < myJavaHierarchyTree.getRowCount(); row++) { Object o = myJavaHierarchyTree.getPathForRow(row).getLastPathComponent(); if (o instanceof JavaElement) { String filterText = myFilterTextField.getText(); if (Utils.patternMatch((JavaElement)o, filterText, filterText.toLowerCase())) { myJavaHierarchyTree.setSelectionRow(row); myJavaHierarchyTree.scrollRowToVisible(row); return; } } } myFilterTextField.setForeground(Color.RED); }
if (htn.getUrl()!=null && htn.getUrl().equals(url)) { tocTree.setSelectionRow(i); tocTree.scrollRowToVisible(i); return;
tree.scrollRowToVisible(row);
@Override protected void setSelectedIndex(int index, boolean incremental) { if (!isRecursive()) { if (incremental) { ((JTree) _component).addSelectionInterval(index, index); } else { ((JTree) _component).setSelectionRow(index); } ((JTree) _component).scrollRowToVisible(index); } else { Object elementAt = getElementAt(index); if (elementAt instanceof TreePath) { // else case should never happen TreePath path = (TreePath) elementAt; if (incremental) { ((JTree) _component).addSelectionPath(path); } else { ((JTree) _component).setSelectionPath(path); } ((JTree) _component).scrollPathToVisible(path); } } }