0

I need zoom in/out in ScrollPane relative to mouse position. for that I used answer of this question, so far everything is fine. I need another thing too , when I fullSreen the window Vbox fill the whole page. for that change this little part of code : 1. set max size of Group to Double.Max_value :

public panelable(Node target) {
    super();
    this.target = target;
    this.zoomNode = new Group(target);
    zoomNode.maxHeight( Double.MAX_VALUE) ;
    zoomNode.maxWidth( Double.MAX_VALUE) ;
    setContent(outerNode(zoomNode));
    setPannable(true);
    setFitToHeight(true); //center
    setFitToWidth(true); //center
    updateScale();
}

2.declare vgrow for VBox :

  private Node centeredNode(Node node) {
    VBox vBox = new VBox(node);
    VBox.setVgrow( node , Priority.ALWAYS);
    vBox.setAlignment(Pos.CENTER);
    return vBox;
}

but Group isn't resizable and this code isn't working .Furthermore, as Oracle ScrollPane documentation saying in my case need to wrap the scroll node in a Group. so, what can i do? is there a solution? help me please. this is my main class code :

public class Main extends Application {
@Override
public void start(Stage primaryStage) throws Exception{
    StackPane stackPane = new StackPane() ;
    stackPane.setPrefSize( 600, 600);
    stackPane.setMaxSize( Double.MAX_VALUE ,  Double.MAX_VALUE);
    stackPane.setStyle( "-fx-background-color: red");
    primaryStage.setScene(new Scene( new panelable( stackPane)));
    primaryStage.show();
}
public static void main(String[] args) {
    launch(args);
}}

0 Answers0