简体   繁体   English

如何在JFXtras窗口中使用FXML文档?

[英]How to use FXML document in a JFXtras window?

For content of JFXtras window object, should we use only code part on IDE? 对于JFXtras窗口对象的内容,我们应该仅在IDE上使用代码部分吗?

Window w = new Window("My Window#"+counter);
w.getContentPane().getChildren().add(new Label("Content... \nof the window#"));
root.getChildren().add(w);

For example, i prepared an fxml document with scene builder, i want it to be shown in jfxtras window. 例如,我用场景生成器准备了一个fxml文档,我希望它在jfxtras窗口中显示。 But i couldn't make the window like a stage. 但是我不能把窗户做成一个舞台。

Load fxml in Node and set as content Node加载fxml并设置为内容

Node node = FXMLLoader.load(getClass().getResource("yourFxml.fxml"));
w.getContentPane().getChildren().add(node);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM