title: JavaFx: In TreeView Need Only Scroll to Index number when treeitem is out of View
body: <p>I need to do a simple thing. I have a large TreeView. and a menu item Next and Previous. on Next I have to select next Tree Item. Tree List Look like this</p>
  
  <pre><code>-Root(set visible hide is true for root)
   --Parent 1
   ----Child 1
   ----Child 2
   ----Child 3
   --Parent 2
   ----Child 1
   ----Child 2
  </code></pre>
  
  <p>Now By pressing Next or previous menu item i call  </p>
  
  <pre><code>myTreeView.getSelectionModel().clearAndSelect(newIndex);
  </code></pre>
  
  <p>By This I have manage to select next item and by  </p>
  
  <pre><code>myTreeView.getSelectionModel().scrollTo(newIndex) 
  </code></pre>
  
  <p>i have manage to scroll to selected treeitem. </p>
  
  <h1>Problam:</h1>
  
  <p>Let I select the first item manually. after this i press next button. Now This cause a weird behavior that it always scrolls weather new selected treeitem is in view (bounds of view able area) or out of view. let assume i have large list of tree items. and my requirement is just i only want scroll happened only when new selected tree item go out of view. can any body suggest how to achieve this?? </p>
  
  <p>Thanks.</p>