apps/samples/3DViewer/src/main/java/com/javafx/experiments/jfx3dviewer/SubSceneResizer.java

Print this page




  65                 setPrefSize(this.subScene.getWidth(),this.subScene.getHeight());
  66                 if (getChildren().size() == 1) {
  67                     getChildren().add(0,this.subScene);
  68                 } else {
  69                     getChildren().set(0,this.subScene);
  70                 }
  71             }
  72         });
  73         setMinSize(50,50);
  74         setMaxSize(Double.MAX_VALUE,Double.MAX_VALUE);
  75         getChildren().add(controlsPanel);
  76     }
  77 
  78     @Override protected void layoutChildren() {
  79         final double width = getWidth();
  80         final double height = getHeight();
  81         if (subScene!=null) {
  82             subScene.setWidth(width);
  83             subScene.setHeight(height);
  84         }
  85         final int controlsWidth = (int)snapSize(controlsPanel.prefWidth(-1));
  86         final int controlsHeight = (int)snapSize(controlsPanel.prefHeight(-1));
  87         controlsPanel.resizeRelocate(width-controlsWidth,0,controlsWidth,controlsHeight);
  88     }
  89 }


  65                 setPrefSize(this.subScene.getWidth(),this.subScene.getHeight());
  66                 if (getChildren().size() == 1) {
  67                     getChildren().add(0,this.subScene);
  68                 } else {
  69                     getChildren().set(0,this.subScene);
  70                 }
  71             }
  72         });
  73         setMinSize(50,50);
  74         setMaxSize(Double.MAX_VALUE,Double.MAX_VALUE);
  75         getChildren().add(controlsPanel);
  76     }
  77 
  78     @Override protected void layoutChildren() {
  79         final double width = getWidth();
  80         final double height = getHeight();
  81         if (subScene!=null) {
  82             subScene.setWidth(width);
  83             subScene.setHeight(height);
  84         }
  85         final double controlsWidth = snapSizeX(controlsPanel.prefWidth(-1));
  86         final double controlsHeight = snapSizeY(controlsPanel.prefHeight(-1));
  87         controlsPanel.resizeRelocate(width-controlsWidth,0,controlsWidth,controlsHeight);
  88     }
  89 }