Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在将 Java FX 用于桌面应用程序。我可以在一个场景中更改场景吗?第一个场景有一个锚窗格,其中包含另一个锚窗格。我可以在第二个锚窗格中更改场景吗?
只需在 Anchorpane 中加载 AnchorPane。无需创造新场景..
AnchorPane main=new AnchorPane(); AnchorPane sub=new AnchorPane(); sub.getChildren().add(btn); main.getChildren().add(sub);
Scene 是 Node 的超类,所以我认为在 Scene 中加载场景是不可能的。但是你可以在一个阶段切换场景。