如何调整JavaFX 3D SubScene的大小? [英] How to resize a JavaFX 3D SubScene?

查看:238
本文介绍了如何调整JavaFX 3D SubScene的大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此代码将创建一个3d场景是300x300大。当我调整包含窗口/舞台的大小时,视口不会调整大小。

This code will create a 3d scene that is 300x300 large. The viewport won't resize when I resize the containing window/stage.

没有任何 width height 属性。如何将 Parent 和/或 SubScene 的大小调整为更改窗口大小?

Parent doesn't have any width or height properties. How do I adjust the size of the Parent and/or SubScene to the changing window size?

推荐答案

将其绑定到父级

SubScene subscene = new SubScene(root, 1024, 768, true, null);
subscene.setFill(Color.GREY);
subscene.setCamera(camera);
StackPane stackPane = new StackPane();
stackPane.getChildren().add(subscene);
subscene.heightProperty().bind(stackPane.heightProperty());
subscene.widthProperty().bind(stackPane.widthProperty());

这篇关于如何调整JavaFX 3D SubScene的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆