autoscroll - how to ensure visible a node into a TitlePane which is into a scrollpane in javafx -


i have scrollpane has various titledpane this, each titledpane has various textfield's children. when navigate throughout textfield's using tab key, scrollpane not autoscroll ensure visible control gaining focus. program demonstrating problem.

import java.util.random;  import javafx.application.application; import javafx.scene.scene; import javafx.scene.control.scrollpane; import javafx.scene.control.textfield; import javafx.scene.control.titledpane; import javafx.scene.layout.anchorpane; import javafx.scene.layout.pane; import javafx.scene.layout.vbox; import javafx.stage.stage;  public class scrollpaneensurevisible extends application {      private static final random random = new random();      @override     public void start(stage primarystage) {          vbox root = new vbox();         scrollpane scrollpane = new scrollpane();         pane content = new pane();         scrollpane.setcontent(content);          (int = 0; < 3; i++) {             titledpane pane = new titledpane();             anchorpane panecontent = new anchorpane();             (int j = 0; j < 2; j++) {                 textfield text = new textfield();                 panecontent.getchildren().add(text);                 text.setlayoutx(8);                 text.setlayouty(j*30);             }             pane.setcollapsible(false);             pane.setcontent(panecontent);             pane.setlayouty(i*100);             content.getchildren().add(pane);         }          root.getchildren().add(scrollpane);          scrollpane = new scrollpane();         content = new pane();         scrollpane.setcontent(content);         (int = 0; < 3; i++) {             titledpane pane = new titledpane();             anchorpane panecontent = new anchorpane();             pane.setcontent(panecontent);             pane.setprefwidth(200);             pane.setprefheight(80);             pane.setcollapsible(false);             pane.setlayouty(i*100);             content.getchildren().add(pane);         }          root.getchildren().add(scrollpane);           scene scene = new scene(root, 300, 250);         primarystage.setscene(scene);         primarystage.show();     }      public static void main(string[] args) { launch(); } } 

for second titledpane fine, first not. need sensure visible (autoscroll scrollpane) controls when gain focus.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -